models4datatug

package
v0.72.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 32 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Copyright 2026 Sneat.co

Package models4datatug holds this extension's database objects and the DALgo keys they are stored under. Shared linkage reuses published contract DTOs; no database client or peer extension implementation is imported.

Copyright 2026 Sneat.co

Index

Constants

View Source
const (
	AccessAgentActive   = "active"
	AccessAgentDisabled = "disabled"
)

AccessAgentActive and AccessAgentDisabled are the states of a registered agent.

View Source
const (
	AccessAgentSessionActive  = "active"
	AccessAgentSessionEnded   = "ended"
	AccessAgentSessionExpired = "expired"
)

Agent session states (Perimeter REQ:agent-sessions). A session that left AccessAgentSessionActive never returns to it.

View Source
const (
	CloudJoinBasisOwner      = "owner"
	CloudJoinBasisJoinerPro  = "joiner_pro"
	CloudJoinBasisOwnerQuota = "owner_quota"
)

Join bases of a cloud project member. Only CloudJoinBasisOwnerQuota members count against the owner's Pro quota (plans-and-ai-metering REQ plan-record).

View Source
const (
	DetectiveChecksCollection               = "detectiveChecks"
	DetectiveValidatorsCollection           = "detectiveValidators"
	DetectiveQueryValidatorsCollection      = "detectiveQueryValidators"
	DetectiveCasesCollection                = "detectiveCases"
	DetectiveScenariosCollection            = "detectiveScenarios"
	DetectiveRunsCollection                 = "detectiveRuns"
	DetectiveProducedRunsCollection         = "detectiveProducedRuns"
	DetectiveQuerySnapshotsCollection       = "detectiveQuerySnapshots"
	DetectivePinnedQuerySnapshotsCollection = "detectivePinnedQuerySnapshots"
	DetectiveQueryAcceptancesCollection     = "detectiveQueryAcceptances"
	DetectiveRunAcceptancesCollection       = "detectiveRunAcceptances"
	DetectiveCaseEventsCollection           = "detectiveCaseEvents"
	DetectiveCaseRunLinksCollection         = "detectiveCaseRunLinks"
	DetectiveReceiptsCollection             = "detectiveReceipts"
	DetectiveAuditCollection                = "detectiveAudit"
	DetectiveDemoCollection                 = "detectiveDemo"
	DetectiveKnowledgeCollection            = "detectiveKnowledge"
	DetectiveAIProposalsCollection          = "detectiveAIProposals"
	DetectiveIncidentIntentsCollection      = "detectiveIncidentIntents"
	DetectiveIncidentRecordsCollection      = "detectiveIncidentRecords"
	DetectiveIncidentEventsCollection       = "detectiveIncidentEvents"
	DetectiveIncidentReceiptsCollection     = "detectiveIncidentReceipts"
	DetectiveIncidentCountersCollection     = "detectiveIncidentCounters"
	DetectiveProjectsCollection             = "detectiveProjects"
	MaxDetectiveRecordBytes                 = 256 << 10
)

Detective records are private descendants of one Space-owned project. The host's Firestore rules must deny direct client reads and writes for every collection here; all access goes through authenticated HTTPS project grants.

View Source
const (
	FreeMoneySettingsCollection = "freeMoneySettings"
	FreeMoneyMonthCollection    = "freeMoneyMonths"
)
View Source
const (
	GithubAppCredentialsCollection      = "githubAppCredentials"      // #nosec G101 -- private record collection name, not a credential value.
	GithubOAuthAppCredentialsCollection = "githubOAuthAppCredentials" // #nosec G101 -- private record collection name, not a credential value.
	GithubOAuthStatesCollection         = "githubOAuthStates"
)
View Source
const (
	GitHubProjectCreateOperationsCollection = "githubProjectCreateOperations"
	GitHubProjectInitializing               = "initializing"
	GitHubProjectReady                      = "ready"
	GitHubProjectPendingMerge               = "pending_merge"
	GitHubProjectClosedUnmerged             = "closed_unmerged"
	GitHubProjectNeedsReview                = "needs_review"
)
View Source
const (
	SpacesCollection  = "spaces"
	PlanCollection    = "plan"
	AIUsageCollection = "aiUsage"
)
View Source
const (
	PlanApplicationCollection = "planApplications"
	PaidMoneyMonthCollection  = "paidMoneyMonths"
)
View Source
const (
	// ProjectsCollection stores DataTug projects.
	ProjectsCollection = "projects"

	// UsersCollection is the platform's users collection.
	UsersCollection = "users"

	// UserExtCollection is the platform's collection of per-extension user
	// documents: users/{userID}/ext/{extID}. The DataTug extension's user data
	// (which stores and projects the user can see) lives there, never inline in
	// the core users/{userID} document. This mirrors the key that
	// sneat-core-modules' dal4userus.NewUserExtKey builds; the module builds it
	// itself so that it depends on dal-go only.
	UserExtCollection = "ext"

	// FirestoreStoreID is the store id of the DataTug cloud store. It is what
	// the web client sends as `?store=` and the key of the store brief in the
	// user's index.
	FirestoreStoreID = "firestore"

	// FirestoreStoreTitle is the human-readable title of the cloud store.
	FirestoreStoreTitle = "DataTug cloud"

	// GithubStoreID is the store id of a project hosted in a GitHub repository —
	// the id the web client's GitHub reader and navigation use.
	GithubStoreID = "github.com"

	// GithubStoreType is the store type reported for GitHub-hosted projects.
	GithubStoreType = "github"

	// GithubStoreTitle is the human-readable title of the GitHub store.
	GithubStoreTitle = "GitHub"

	// DefaultGithubProjectFolder is the repo folder a project lives in when the
	// user does not name one — the same default the web client's
	// parseGithubProjectId() applies.
	DefaultGithubProjectFolder = "datatug"

	// AccessPrivate means only the userIDs listed on the project can read it.
	AccessPrivate = "private"

	// ConnectionCatalogOwn marks a project that serves its own connections.
	ConnectionCatalogOwn = "own"
)
View Source
const (
	ProjectRoleViewer      ProjectRoleID = "viewer"
	ProjectRoleContributor ProjectRoleID = "contributor"
	ProjectRoleOwner       ProjectRoleID = "owner"

	ProjectRoleCatalogVersion uint16 = 1
)
View Source
const (
	QueryActivitySourceID                = "datatug-browser-activity/1"
	QueryActivityContextsCollection      = "queryActivityContexts"
	QueryActivityContextQuotasCollection = "queryActivityContextQuotas"
	QueryActivityReceiptsCollection      = "queryActivityReceipts"
	QueryActivityPendingCollection       = "queryActivityPending"
	QueryActivityMaxContextsPerMinute    = 60
	QueryActivityMaxReportsPerMinute     = 60
)
View Source
const (
	QueryActivityPendingStatePending   = "pending"
	QueryActivityPendingStateDelivered = "delivered"
)
View Source
const (
	QueryActivityPeriodCheckpointsCollection = "queryActivityPeriodCheckpoints"
	QueryActivityPeriodSequencesCollection   = "queryActivityPeriodSequences"
	QueryActivityCheckpointOpening           = "opening"
	QueryActivityCheckpointReady             = "ready"
	QueryActivityCheckpointClosing           = "closing"
	QueryActivityCheckpointClosed            = "closed"
	QueryActivitySequencePending             = "pending"
	QueryActivitySequenceDelivered           = "delivered"
)
View Source
const (
	SharedProjectQueriesCollection       = "queries"
	SharedProjectQueryReceiptsCollection = "querySaveReceipts"
	MaxSharedProjectQueryBytes           = 512 << 10
)
View Source
const (
	ShippingSourceID       = "shipping-working-copy"
	ShippingFixtureCommit  = "38a51dda39d988f2d2bcf23703bd1a969d49f4a3"
	ShippingBaseSHA256     = "73f0d871607ee5b24de68b5398c25806f556a3126a31e1865fee79b2881977e0"
	ShippingBlobCollection = "shippingApplicationBlobs"
	ShippingMaxBytes       = 512 << 10
	ShippingMaxGenerations = 4
	ShippingMaxRevisions   = 16
	ShippingMaxReceipts    = 32
)

Shipping working copies are native descendants of the existing Space project. Blob bytes require a deployed Firestore field-index exemption; tags alone do not configure provider indexes. Direct client access must remain denied.

View Source
const AccessProtected = "protected"
View Source
const CloudInviteAttemptsCollection = "cloudInviteAttempts"

CloudInviteAttemptsCollection holds pin attempts below the project's detectiveProjects root, which Firestore rules keep from every client and the project purge removes.

View Source
const GitHubQueryEditSourceID = "github-query-draft/1"
View Source
const PostmortemCandidatesCollection = "postmortemCandidates"
View Source
const PostmortemLinksCollection = "postmortemLinks"
View Source
const PostmortemPublicationsCollection = "postmortemPublications"
View Source
const PostmortemReportsCollection = "postmortemReports"
View Source
const PostmortemRevisionsCollection = "postmortemRevisions"
View Source
const PostmortemSendsCollection = "postmortemSends"
View Source
const ProjectAdmissionCollection = "projectAdmissions"
View Source
const ProjectConnectionSavesCollection = "connectionSaves"

ProjectConnectionSavesCollection holds save_connection operation receipts under the project document.

View Source
const ProtectedProjectQuotaCollection = "protectedProjectQuota"

These server-only roots require Firebase read/list exclusions at every depth before activation: spaces/{payer}/ext/datatug/protectedProjectQuota/{scope} and spaces/{projectSpace}/ext/datatug/projectAdmissions/{projectID}.

View Source
const QueryEditCandidateCollection = "queryEditCandidates"
View Source
const QueryEditUnclassified = "unclassified"
View Source
const SharedProjectCreateReceiptsCollection = "projectCreates"

SharedProjectCreateReceiptsCollection holds the create receipts of a Space's projects: spaces/{spaceID}/ext/datatug/projectCreates/{sha256(commandID)}.

View Source
const SpaceAccessMaxCohort = 20
View Source
const SpaceAccessMaxGrants = 20
View Source
const SpaceAccessMaxGraphBytes = 65536
View Source
const SpaceAccessPolicyVersion = "datatug-space-access/1"
View Source
const TeamProjectsCollection = "teamProjects"
View Source
const WorkActivityCollection = "workActivity"
View Source
const WorkControlCollection = "workControl"
View Source
const WorkItemsCollection = "workItems"
View Source
const WorkLinksCollection = "workLinks"
View Source
const WorkReceiptsCollection = "workReceipts"

Variables

View Source
var ErrInvalidBusinessUsageWorkerState = errors.New("invalid business usage worker state")
View Source
var ErrInvalidFreeMoneyKey = errors.New("invalid Free money key scope")
View Source
var (
	ErrInvalidGitHubBinding = errors.New("invalid GitHub project binding")
)
View Source
var ErrInvalidGitHubQueryOperation = errors.New("invalid GitHub query operation")
View Source
var ErrInvalidQueryActivity = errors.New("invalid query activity record")
View Source
var ErrInvalidQueryActivityPeriod = errors.New("invalid query activity period checkpoint")
View Source
var ErrInvalidQueryEditCandidate = errors.New("invalid query edit candidate")
View Source
var ErrInvalidWork = errors.New("invalid work item")
View Source
var ErrWorkTransition = errors.New("invalid work transition")

Functions

func AccessAgentSessionsCollection added in v0.70.0

func AccessAgentSessionsCollection(spaceID string) dal.CollectionRef

func AccessAgentsCollection added in v0.69.0

func AccessAgentsCollection(spaceID string) dal.CollectionRef

func AccessGrantsCollection added in v0.60.11

func AccessGrantsCollection(spaceID string) dal.CollectionRef

func AccessProtectionID added in v0.60.11

func AccessProtectionID(projectID, catalogConnectionID string) string

AccessProtectionID is stable and Space-local. Canonical JSON separates the project and catalog identifiers without delimiter ambiguity.

func CanonicalQueryActivityTime added in v0.20.0

func CanonicalQueryActivityTime(value time.Time) time.Time

CanonicalQueryActivityTime normalises to the precision DALgo storage keeps. Callers must check raw server time against raw paid boundaries before using this value for any persisted time or digest.

func CloudInviteContactID added in v0.60.6

func CloudInviteContactID(projectID, operationID string) string

CloudInviteContactID is the Space contact create_invite writes for one client operation. It is derived from the project and the operation ID, so a retry adopts the contact, and with it the invite, that an earlier attempt created instead of writing a second pair.

func CloudOwnerQuotaDigest added in v0.60.6

func CloudOwnerQuotaDigest(ownerID, payerID, spaceID, projectID, inviteID string) string

CloudOwnerQuotaDigest is the request digest of the owner admission a cloud project receives on its first owner-quota join.

func CloudProjectCloneCreateDigest added in v0.61.1

func CloudProjectCloneCreateDigest(actor, space, command, title string, source CloudProjectCloneSource) string

func DetectiveProjectScopeKey added in v0.29.1

func DetectiveProjectScopeKey(storeID, projectID, branch string) string

DetectiveProjectScopeKey binds the normalized store, project and branch to a single opaque server-only namespace. The Space remains the outer authority.

func DetectiveRequestDigest added in v0.29.1

func DetectiveRequestDigest(spaceID, projectID, actorID, action string, payload any) (string, error)

func GitHubSharedProjectCreateDigest added in v0.14.0

func GitHubSharedProjectCreateDigest(actorID, spaceID, commandID, title, payer, mode, product string, source GitHubCreateSource) string

func GlobalExtensionKey added in v0.59.1

func GlobalExtensionKey() *record.Key

GlobalExtensionKey owns private DataTug records and deployment-wide indexes. Space-owned project and usage authority use their existing Space extension.

func IsBusinessTeamSpaceType added in v0.63.0

func IsBusinessTeamSpaceType(spaceType string) bool

IsBusinessTeamSpaceType accepts business types from existing Space records, including strings that predate or extend Core's current enum. It excludes generic groups, personal/family Spaces and DataTug's dedicated project Spaces.

func NewAIUsageKey added in v0.4.0

func NewAIUsageKey(accountID, periodID string) *record.Key

func NewCurrentPlanKey added in v0.4.0

func NewCurrentPlanKey(accountID string) *record.Key

NewCurrentPlanKey names only the live entitlement document. Test-mode reconciliation deliberately uses a different key and never feeds readers.

func NewDetectiveDocumentKey added in v0.29.1

func NewDetectiveDocumentKey(spaceID, projectID, collection, id string) *record.Key

func NewFreeMoneyGlobalMonthKey added in v0.8.0

func NewFreeMoneyGlobalMonthKey(mode, product, periodID string) (*record.Key, error)

NewFreeMoneyGlobalMonthKey selects the shared private UTC-month counter.

func NewFreeMoneyPersonMonthKey added in v0.8.0

func NewFreeMoneyPersonMonthKey(mode, product, verifiedUserID, periodID string) (*record.Key, error)

NewFreeMoneyPersonMonthKey selects a verified person's private UTC-month counter. The caller must supply a server-verified user ID.

func NewFreeMoneySettingsKey added in v0.8.0

func NewFreeMoneySettingsKey(mode, product string) (*record.Key, error)

NewFreeMoneySettingsKey selects one private configuration per mode and product. The caller must supply a server-resolved mode; no settings record is created here.

func NewGithubAppCredentialKey added in v0.13.0

func NewGithubAppCredentialKey(userID string) *record.Key

NewGithubAppCredentialKey addresses a private extension record for one Firebase user. It deliberately lives outside users/{uid}, whose recursive client-read rule would otherwise expose even encrypted credential metadata.

func NewGithubOAuthAppCredentialKey added in v0.59.1

func NewGithubOAuthAppCredentialKey(userID string) *record.Key

NewGithubOAuthAppCredentialKey keeps classic OAuth App credentials isolated from legacy GitHub App user credentials.

func NewGithubOAuthStateKey added in v0.13.0

func NewGithubOAuthStateKey(userID, stateDigest string) *record.Key

NewGithubOAuthStateKey addresses a single-use state in the private extension collection. The id contains hashes of both the Firebase UID and OAuth state.

func NewGithubProjectID added in v0.2.0

func NewGithubProjectID(org, repo, folder string) string

NewGithubProjectID builds the id a GitHub-hosted project is addressed by: `repo@org@folder` — the format the web client's parseGithubProjectId() expects.

func NewPaidMoneyMonthKey added in v0.5.0

func NewPaidMoneyMonthKey(mode, family, accountID, periodID string) *record.Key

func NewPlanApplicationKey added in v0.5.0

func NewPlanApplicationKey(mode, family, accountID string) *record.Key

func NewProjectContactLinkageRecord added in v0.12.0

NewProjectContactLinkageRecord projects only the existing Contactus linkage fields. Mutation callers update those fields only, never contact identity or status. Contact authorization is supplied by the current-contact port.

func NewProjectKey

func NewProjectKey(projectID string) *record.Key

NewProjectKey builds the dalgo key of a project record.

func NewQueryActivityContextID added in v0.20.0

func NewQueryActivityContextID(actorID, projectID string, period contract4paymentus.UsagePeriodRef) string

NewQueryActivityContextID reuses one context per actor/project/paid period. Proof revisions update the current authority snapshot in place; they do not create rows or change the immutable operation identity.

func NewQueryActivityContextQuotaID added in v0.20.0

func NewQueryActivityContextQuotaID(actorID string, period contract4paymentus.UsagePeriodRef) string

func NewQueryActivityEventID added in v0.20.0

func NewQueryActivityEventID(contextID, operationID string) string

func NewQueryActivityPeriodID added in v0.23.1

func NewQueryActivityPeriodID(period contract4paymentus.UsagePeriodRef) string

func NewQueryActivityReceiptID added in v0.20.0

func NewQueryActivityReceiptID(actorID string, period contract4paymentus.UsagePeriodRef) string

func NewQueryEditCandidateID added in v0.18.0

func NewQueryEditCandidateID(actorID, operationID string) string

func NewSpaceAccessRecord added in v0.63.0

func NewSpaceAccessRecord(space, project, collection, id string, data any) record.Record

func NewSpaceAccessRecordRaw added in v0.63.0

func NewSpaceAccessRecordRaw(space, project, collection, id string, data any) record.Record

NewSpaceAccessRecordRaw builds the same key as NewSpaceAccessRecord but never seals its data. Read paths must validate the RAW stored AdmissionIdentity/GenerationIndex before any Key() or sealing constructor can overwrite them; a sealing read would make a corrupted row look self-consistent.

func NewTestPlanKey added in v0.4.0

func NewTestPlanKey(accountID string) *record.Key

func NewUserExtKey

func NewUserExtKey(userID, extID string) *record.Key

NewUserExtKey builds the dalgo key of a user's DataTug index record: users/{userID}/ext/{extID}.

func NormalizeSpaceAccessRoles added in v0.63.0

func NormalizeSpaceAccessRoles(roles []string) ([]string, error)

func PaidSharedProjectCreateDigest added in v0.11.0

func PaidSharedProjectCreateDigest(actorID, spaceID, commandID, title, payer, mode, product string) string

func ProjectConnectionSaveDigest added in v0.60.6

func ProjectConnectionSaveDigest(actorID, spaceID, projectID, operationID, ifMatch, demoDB string) string

ProjectConnectionSaveDigest freezes every save_connection payload field.

func QueryActivityBindingDigest added in v0.20.0

func QueryActivityBindingDigest(actorID, spaceID, projectID string, period contract4paymentus.UsagePeriodRef, startUTC, endUTC, paidUntilUTC time.Time, payerBindingDigest, paidProofID, queryUseProofID string) string

QueryActivityBindingDigest freezes the canonical paid and query-use binding that authorized the first accepted report. It deliberately excludes later mutable authority revisions while retaining the original period fence.

func QueryActivityStructuralDigest added in v0.20.0

func QueryActivityStructuralDigest(r QueryActivityReceipt) string

func SharedProjectCreateDigest added in v0.10.0

func SharedProjectCreateDigest(actorID, spaceID, commandID, title string) string

SharedProjectCreateDigest freezes every command payload field; JSON provides unambiguous boundaries even if a caller tries separator-shaped values.

func SharedProjectExtensionKey added in v0.60.6

func SharedProjectExtensionKey(spaceID string) *record.Key

SharedProjectExtensionKey is a Space's DataTug root: spaces/{spaceID}/ext/datatug.

func SharedProjectQueryRequestDigest added in v0.27.0

func SharedProjectQueryRequestDigest(spaceID string, request dto.SaveQueryRequest) (string, error)

func SharedProjectQueryRevision added in v0.27.0

func SharedProjectQueryRevision(query datatug.QueryDefWithFolderPath) string

SharedProjectQueryRevision returns a content-derived opaque revision for the exact Core query DTO persisted by the Firestore adapter.

func SpaceAccessIdentity added in v0.63.0

func SpaceAccessIdentity(parts ...string) string

func SpaceAdmissionGenerationIndex added in v0.63.0

func SpaceAdmissionGenerationIndex(owner, project, grantee string, generation int64, state string) string

func SpaceProjectBriefKey added in v0.60.6

func SpaceProjectBriefKey(spaceID, projectID string) string

SpaceProjectBriefKey is the key of a Space project's brief in a user's DataTug index. It includes the Space id, so equal project ids from two Spaces cannot collide; ':' never occurs in either id.

func ValidateProjectContactRef added in v0.12.0

func ValidateProjectContactRef(ref contract4linkage.RelationshipEntityRef) error

func ValidateProjectLifecycleEpoch added in v0.63.0

func ValidateProjectLifecycleEpoch(epoch string) error

ValidateProjectLifecycleEpoch accepts only the canonical opaque 128-bit lowercase epoch minted by supported native project creation/transition. A blank value is not valid evidence for admission or readonly authorization.

func ValidateSharedProjectIdentifier added in v0.10.0

func ValidateSharedProjectIdentifier(id string) error

ValidateSharedProjectIdentifier accepts one bounded path segment. Core Space authority separately validates that a Space exists and is eligible.

func ValidateSharedProjectTitle added in v0.10.0

func ValidateSharedProjectTitle(title string) error

func WorkLifecycle added in v0.59.1

func WorkLifecycle(kind, status string) string

func WorkLinkID added in v0.59.1

func WorkLinkID(source, relation string, target WorkTarget) string

func WorkTransitions added in v0.59.1

func WorkTransitions(kind, status string) []string

Types

type AIUsageRecord added in v0.4.0

type AIUsageRecord struct {
	V         int              `json:"v" firestore:"v"`
	PeriodID  string           `json:"periodId" firestore:"periodId"`
	Used      int64            `json:"used" firestore:"used"`
	Questions int64            `json:"questions" firestore:"questions"`
	ByMember  map[string]int64 `json:"byMember,omitempty" firestore:"byMember,omitempty"`
	Capped    bool             `json:"capped,omitempty" firestore:"capped,omitempty"`
	ResetsAt  *time.Time       `json:"resetsAt,omitempty" firestore:"resetsAt,omitempty"`
	UpdatedAt *time.Time       `json:"updatedAt,omitempty" firestore:"updatedAt,omitempty"`
}

AIUsageRecord is the version-1 UTC-month usage document.

type AccessAgent added in v0.69.0

type AccessAgent struct {
	ProjectID         string             `json:"projectId" firestore:"projectId"`
	Name              string             `json:"name" firestore:"name"`
	RegisteredBy      dataaccess.Subject `json:"registeredBy" firestore:"registeredBy"`
	RegisteredByRealm string             `json:"registeredByRealm" firestore:"registeredByRealm"`
	RegisteredByID    string             `json:"registeredById" firestore:"registeredById"`
	State             string             `json:"state" firestore:"state"`
	CreatedAt         time.Time          `json:"createdAt" firestore:"createdAt"`
	UpdatedAt         time.Time          `json:"updatedAt" firestore:"updatedAt"`
	Revision          int64              `json:"revision" firestore:"revision"`
}

AccessAgent is an AI agent on its own account in one project (Perimeter REQ:agent-access). The person who registered it is its user: the agent asks them first and never exceeds their access. It carries no credential.

func NewAccessAgentRecord added in v0.69.0

func NewAccessAgentRecord(spaceID, agentID string) (record.Record, *AccessAgent)

type AccessAgentSession added in v0.70.0

type AccessAgentSession struct {
	ProjectID           string    `json:"projectId" firestore:"projectId"`
	AgentID             string    `json:"agentId" firestore:"agentId"`
	UserRealm           string    `json:"userRealm" firestore:"userRealm"`
	UserID              string    `json:"userId" firestore:"userId"`
	Harness             string    `json:"harness" firestore:"harness"`
	HarnessDigest       string    `json:"harnessDigest" firestore:"harnessDigest"`
	CredentialDigest    string    `json:"credentialDigest" firestore:"credentialDigest"`
	CredentialExpiresAt time.Time `json:"credentialExpiresAt" firestore:"credentialExpiresAt"`
	// The credential replaced by a restart stays valid until its own expiry.
	PreviousCredentialDigest    string     `json:"previousCredentialDigest,omitempty" firestore:"previousCredentialDigest,omitempty"`
	PreviousCredentialExpiresAt time.Time  `json:"previousCredentialExpiresAt,omitempty" firestore:"previousCredentialExpiresAt,omitempty"`
	StartedAt                   time.Time  `json:"startedAt" firestore:"startedAt"`
	LastUsedAt                  time.Time  `json:"lastUsedAt" firestore:"lastUsedAt"`
	MaxEndsAt                   time.Time  `json:"maxEndsAt" firestore:"maxEndsAt"`
	EndedAt                     *time.Time `json:"endedAt,omitempty" firestore:"endedAt,omitempty"`
	EndReason                   string     `json:"endReason,omitempty" firestore:"endReason,omitempty"`
	State                       string     `json:"state" firestore:"state"`
	Revision                    int64      `json:"revision" firestore:"revision"`
}

AccessAgentSession is a server-minted agent session (D29). The harness session ID and the credential are kept only as SHA-256 digests: the harness ID is a lookup key, never authority, and the credential is never stored.

func NewAccessAgentSessionRecord added in v0.70.0

func NewAccessAgentSessionRecord(spaceID, sessionID string) (record.Record, *AccessAgentSession)

type AccessDelegation added in v0.60.11

type AccessDelegation struct {
	RoleID            string                  `json:"roleId" firestore:"roleId"`
	Permissions       []dataaccess.Permission `json:"permissions" firestore:"permissions"`
	MaxReadSeconds    int                     `json:"maxReadSeconds" firestore:"maxReadSeconds"`
	AllowSelfApproval bool                    `json:"allowSelfApproval" firestore:"allowSelfApproval"`
}

AccessDelegation is private control-plane policy. Project editing and role assignment permissions never imply this independently configured authority.

type AccessEvent added in v0.60.11

type AccessEvent struct {
	CredentialFamily string             `json:"credentialFamily" firestore:"credentialFamily"`
	ClientID         string             `json:"clientId,omitempty" firestore:"clientId,omitempty"`
	ProjectID        string             `json:"projectId" firestore:"projectId"`
	ConnectionID     string             `json:"connectionId" firestore:"connectionId"`
	GrantID          string             `json:"grantId,omitempty" firestore:"grantId,omitempty"`
	Action           string             `json:"action" firestore:"action"`
	Actor            dataaccess.Subject `json:"actor" firestore:"actor"`
	At               time.Time          `json:"at" firestore:"at"`
	Revision         int64              `json:"revision" firestore:"revision"`
	DecisionBinding  string             `json:"decisionBinding,omitempty" firestore:"decisionBinding,omitempty"`
	DecisionRevision int64              `json:"decisionRevision,omitempty" firestore:"decisionRevision,omitempty"`
	// Agent events (Perimeter REQ:agent-asks-its-user) name the agent and the
	// person it belongs to; references only, never data or query text.
	Agent       *dataaccess.Subject `json:"agent,omitempty" firestore:"agent,omitempty"`
	AgentUser   *dataaccess.Subject `json:"agentUser,omitempty" firestore:"agentUser,omitempty"`
	ForOwnAgent bool                `json:"forOwnAgent,omitempty" firestore:"forOwnAgent,omitempty"`
	ByAgentUser bool                `json:"byAgentUser,omitempty" firestore:"byAgentUser,omitempty"`
	Dormant     bool                `json:"dormant,omitempty" firestore:"dormant,omitempty"`
	// Lifetime and AgentSessionID record an approval's lifetime and the agent
	// session it was filed or used in (D29); empty when not applicable.
	Lifetime       string `json:"lifetime,omitempty" firestore:"lifetime,omitempty"`
	AgentSessionID string `json:"agentSessionId,omitempty" firestore:"agentSessionId,omitempty"`
	// Reason is the end reason of agent.session.ended / agent.session.expired.
	Reason string `json:"reason,omitempty" firestore:"reason,omitempty"`
	// IdempotencyKey is set on events that must be written exactly once.
	IdempotencyKey string `json:"idempotencyKey,omitempty" firestore:"idempotencyKey,omitempty"`
}

func NewAccessEventRecord added in v0.60.11

func NewAccessEventRecord(spaceID, eventID string) (record.Record, *AccessEvent)

type AccessExactReadPolicy added in v0.64.0

type AccessExactReadPolicy struct {
	Version        int     `json:"-" firestore:"version"`
	Generation     int64   `json:"-" firestore:"generation"`
	CoarseRevision int64   `json:"-" firestore:"coarseRevision"`
	WriterRevision int64   `json:"-" firestore:"writerRevision"`
	SnapshotJSON   *string `json:"-" firestore:"snapshotJSON"`
}

AccessExactReadPolicy is private, same-record exact policy storage. None of its generations or source facts are part of a public access projection.

func (AccessExactReadPolicy) Format added in v0.64.0

func (AccessExactReadPolicy) Format(state fmt.State, _ rune)

func (AccessExactReadPolicy) LogValue added in v0.64.0

func (AccessExactReadPolicy) LogValue() slog.Value

type AccessGrant added in v0.60.11

type AccessGrant struct {
	ProjectID           string                 `json:"projectId" firestore:"projectId"`
	CatalogConnectionID string                 `json:"catalogConnectionId" firestore:"catalogConnectionId"`
	SubjectRealm        string                 `json:"subjectRealm" firestore:"subjectRealm"`
	SubjectID           string                 `json:"subjectId" firestore:"subjectId"`
	Fingerprint         dataaccess.Fingerprint `json:"fingerprint" firestore:"fingerprint"`
	// AgentUserRealm and AgentUserID index an agent grant by the person the
	// agent asks first (Perimeter REQ:agent-asks-its-user); empty otherwise.
	AgentUserRealm string `json:"agentUserRealm,omitempty" firestore:"agentUserRealm,omitempty"`
	AgentUserID    string `json:"agentUserId,omitempty" firestore:"agentUserId,omitempty"`
	// AgentSessionID indexes a grant filed in an agent session (D29), so ending
	// the session finds its "This session" approvals and pending requests.
	AgentSessionID string `json:"agentSessionId,omitempty" firestore:"agentSessionId,omitempty"`
	// GrantJSON preserves the shared strict wire contract. Firestore decodes
	// an empty [] into a nil slice, which would erase requires:[] presence.
	GrantJSON string           `json:"grantJson" firestore:"grantJson"`
	Grant     dataaccess.Grant `json:"-" firestore:"-"`
	CreatedAt time.Time        `json:"createdAt" firestore:"createdAt"`
}

func NewAccessGrantRecord added in v0.60.11

func NewAccessGrantRecord(spaceID, grantID string) (record.Record, *AccessGrant)

func (*AccessGrant) DecodeGrant added in v0.60.11

func (g *AccessGrant) DecodeGrant() error

func (*AccessGrant) EncodeGrant added in v0.60.11

func (g *AccessGrant) EncodeGrant() error

type AccessProtection added in v0.60.11

type AccessProtection struct {
	ExactRead           *AccessExactReadPolicy `json:"-" firestore:"exactRead,omitempty"`
	ProjectID           string                 `json:"projectId" firestore:"projectId"`
	CatalogConnectionID string                 `json:"catalogConnectionId" firestore:"catalogConnectionId"`
	Protection          AccessProtectionData   `json:"protection" firestore:"protection"`
	Delegations         []AccessDelegation     `json:"delegations" firestore:"delegations"`
	AllowSelfApproval   bool                   `json:"allowSelfApproval" firestore:"allowSelfApproval"`
	UpdatedBy           dataaccess.Subject     `json:"updatedBy" firestore:"updatedBy"`
	UpdatedAt           time.Time              `json:"updatedAt" firestore:"updatedAt"`
}

func NewAccessProtectionRecord added in v0.60.11

func NewAccessProtectionRecord(spaceID, protectionID string) (record.Record, *AccessProtection)

type AccessProtectionData added in v0.60.11

type AccessProtectionData struct {
	ID                   string                 `json:"id" firestore:"id"`
	Fingerprint          dataaccess.Fingerprint `json:"fingerprint" firestore:"fingerprint"`
	Name                 string                 `json:"name" firestore:"name"`
	Environment          string                 `json:"environment,omitempty" firestore:"environment,omitempty"`
	ReadOnly             bool                   `json:"readOnly" firestore:"readOnly"`
	ReadPosture          dataaccess.ReadPosture `json:"readPosture" firestore:"readPosture"`
	AgentRead            dataaccess.AgentRead   `json:"agentRead" firestore:"agentRead"`
	MaxDuration          map[string]int         `json:"maxDuration,omitempty" firestore:"maxDuration,omitempty"`
	MandatoryFineGrained bool                   `json:"mandatoryFineGrained" firestore:"mandatoryFineGrained"`
	Revision             int64                  `json:"revision" firestore:"revision"`
}

AccessProtectionData is the private storage shape of the shared protection. Firestore's SDK requires exact string map keys; a map[Permission]int panics during transform extraction. Core constructs remain the external contract.

func (AccessProtectionData) CoreProtection added in v0.60.11

type BusinessUsageWorkerState added in v0.23.2

type BusinessUsageWorkerState struct {
	Version             int                     `firestore:"v"`
	Mode                contract4paymentus.Mode `firestore:"mode"`
	CheckpointAfterPath string                  `firestore:"checkpointAfterPath,omitempty"`
	PendingAfterPath    string                  `firestore:"pendingAfterPath,omitempty"`
	UpdatedAtUTC        time.Time               `firestore:"updatedAtUTC"`
}

BusinessUsageWorkerState stores only resumable collection-group scan positions. Business authority remains in each Space-scoped checkpoint.

func NewBusinessUsageWorkerStateRecord added in v0.23.2

func NewBusinessUsageWorkerStateRecord(mode contract4paymentus.Mode) (record.Record, *BusinessUsageWorkerState)

func (BusinessUsageWorkerState) Validate added in v0.23.2

func (s BusinessUsageWorkerState) Validate() error

type CloudInviteAttempts added in v0.60.10

type CloudInviteAttempts struct {
	Count          int64     `json:"count" firestore:"count"`
	WindowStartUTC time.Time `json:"windowStartUTC" firestore:"windowStartUTC"`
}

CloudInviteAttempts counts one caller's refused pin attempts on one invite in the window that starts at WindowStartUTC.

func NewCloudInviteAttemptsRecord added in v0.60.10

func NewCloudInviteAttemptsRecord(spaceID, projectID, actorID, inviteID string) (record.Record, *CloudInviteAttempts)

NewCloudInviteAttemptsRecord keys the record by a hash, so its path names neither the caller nor the invite.

type CloudProjectCloneSource added in v0.61.1

type CloudProjectCloneSource struct {
	RepositoryID  int64  `json:"repositoryID" firestore:"repositoryID"`
	Owner         string `json:"owner" firestore:"owner"`
	Name          string `json:"name" firestore:"name"`
	Folder        string `json:"folder" firestore:"folder"`
	Branch        string `json:"branch" firestore:"branch"`
	Commit        string `json:"commit" firestore:"commit"`
	Tree          string `json:"tree" firestore:"tree"`
	Version       string `json:"version" firestore:"version"`
	VersionStatus string `json:"versionStatus" firestore:"versionStatus"`
}

CloudProjectCloneSource records the immutable source used for a cloud copy. Version is repository/project release metadata, never a schema version.

func (CloudProjectCloneSource) Validate added in v0.61.1

func (s CloudProjectCloneSource) Validate() error

type CloudProjectInvite added in v0.60.6

type CloudProjectInvite struct {
	ContactID   string    `json:"contactID" firestore:"contactID"`
	Role        string    `json:"role" firestore:"role"`
	CreatedAt   time.Time `json:"createdAt" firestore:"createdAt"`
	OperationID string    `json:"operationID,omitempty" firestore:"operationID,omitempty"`
}

CloudProjectInvite is the pending invites[<inviteID>] record.

type CloudProjectMember added in v0.60.6

type CloudProjectMember struct {
	UserID   string    `json:"userID" firestore:"userID"`
	Role     string    `json:"role" firestore:"role"`
	Basis    string    `json:"basis" firestore:"basis"`
	InviteID string    `json:"inviteID" firestore:"inviteID"`
	JoinedAt time.Time `json:"joinedAt" firestore:"joinedAt"`
}

CloudProjectMember is the members[<contactID>] record of an admitted collaborator. It holds no account or payer ID: the gates re-resolve a Pro joiner's personal account on each check.

type CloudProjectQuotaReservation added in v0.60.6

type CloudProjectQuotaReservation struct {
	UserID     string    `json:"userID" firestore:"userID"`
	ReservedAt time.Time `json:"reservedAt" firestore:"reservedAt"`
}

CloudProjectQuotaReservation is the quotaReservations[<inviteID>] record: the joiner holds one owner-quota collaborator place until the claim finalizes. It carries no plan, payer or subscription data, because every Space member can read the project document.

type CloudProjectQuotaSlot added in v0.60.6

type CloudProjectQuotaSlot struct {
	InviteID   string    `json:"inviteID" firestore:"inviteID"`
	UserID     string    `json:"userID" firestore:"userID"`
	ReservedAt time.Time `json:"reservedAt" firestore:"reservedAt"`
}

CloudProjectQuotaSlot records that the owner's shared-project slot is held for this project (protectedProjectQuota.Allocated counts it) while no owner admission exists yet. The first owner-quota join to finalize turns it into the admission and clears it.

type CloudProjectSharing added in v0.60.6

type CloudProjectSharing struct {
	// Invites are pending invites by Sneat invite ID. A pending invite grants nothing.
	Invites map[string]*CloudProjectInvite `json:"invites,omitempty" firestore:"invites,omitempty"`
	// QuotaReservations hold the owner's quota for a join between the
	// reservation and the invite claim, keyed by invite ID.
	QuotaReservations map[string]*CloudProjectQuotaReservation `json:"quotaReservations,omitempty" firestore:"quotaReservations,omitempty"`
	// QuotaSlot is set while the owner's project slot is held for an unfinalized join.
	QuotaSlot *CloudProjectQuotaSlot `json:"quotaSlot,omitempty" firestore:"quotaSlot,omitempty"`
	// Members records the join basis of each admitted collaborator by contact ID.
	Members map[string]*CloudProjectMember `json:"members,omitempty" firestore:"members,omitempty"`
}

CloudProjectSharing is the share-and-join state stored on a project created by create_cloud_project, at spaces/{spaceID}/ext/datatug/projects/{projectID}. The role edges themselves live only in the Linkage graph.

func (CloudProjectSharing) OwnerQuotaMembers added in v0.60.6

func (s CloudProjectSharing) OwnerQuotaMembers() int64

OwnerQuotaMembers counts the collaborators admitted under the owner's plan.

type Created

type Created struct {
	At time.Time `json:"at" firestore:"at"`
}

Created holds the creation timestamp of a DataTug record.

type DetectiveAcceptedQuery added in v0.29.1

type DetectiveAcceptedQuery struct {
	SourcePin *ShippingSourcePin `json:"sourcePin,omitempty" firestore:"sourcePin"`
	Revision  string             `json:"revision" firestore:"revision"`
	JSON      []byte             `json:"json" firestore:"json"`
}

type DetectiveAudit added in v0.29.1

type DetectiveAudit struct {
	Version   int                  `json:"v" firestore:"v"`
	SpaceID   string               `json:"spaceID" firestore:"spaceID"`
	ProjectID string               `json:"projectID" firestore:"projectID"`
	Event     detective.AuditEvent `json:"event" firestore:"event"`
}

Audit contains redacted metadata only. Context/input values, query rows, pasted content and credentials are deliberately absent from this type.

func NewDetectiveAuditRecord added in v0.29.1

func NewDetectiveAuditRecord(spaceID, projectID, id string) (record.Record, *DetectiveAudit)

type DetectiveDemoAdmission added in v0.29.1

type DetectiveDemoAdmission struct {
	Version        int       `json:"v" firestore:"v"`
	SpaceID        string    `json:"spaceID" firestore:"spaceID"`
	ProjectID      string    `json:"projectID" firestore:"projectID"`
	ActorID        string    `json:"actorID" firestore:"actorID"`
	TemplateCommit string    `json:"templateCommit" firestore:"templateCommit"`
	Environments   []string  `json:"environments" firestore:"environments"`
	CreatedAt      time.Time `json:"createdAt" firestore:"createdAt"`
}

DemoAdmission is a separate, limited product grant. Paid admission records retain their existing meaning and are never synthesized for a free demo.

func NewDetectiveDemoAdmissionRecord added in v0.29.1

func NewDetectiveDemoAdmissionRecord(spaceID, projectID string) (record.Record, *DetectiveDemoAdmission)

type DetectiveDemoCreateReceipt added in v0.29.1

type DetectiveDemoCreateReceipt struct {
	Version       int       `json:"v" firestore:"v"`
	ActorID       string    `json:"actorID" firestore:"actorID"`
	SpaceID       string    `json:"spaceID" firestore:"spaceID"`
	ProjectID     string    `json:"projectID" firestore:"projectID"`
	OperationID   string    `json:"operationID" firestore:"operationID"`
	RequestDigest string    `json:"requestDigest" firestore:"requestDigest"`
	CreatedAt     time.Time `json:"createdAt" firestore:"createdAt"`
}

func NewDetectiveDemoCreateReceiptRecord added in v0.29.1

func NewDetectiveDemoCreateReceiptRecord(spaceID, projectID, actorID, operationID string) (record.Record, *DetectiveDemoCreateReceipt)

type DetectiveDocument added in v0.29.1

type DetectiveDocument struct {
	// WorkItemID marks specialised records whose shared metadata is resolved
	// from the canonical WorkItem. It is immutable after migration.
	WorkSubjects []string  `json:"workSubjects,omitempty" firestore:"workSubjects,omitempty"`
	WorkItemID   string    `json:"workItemId,omitempty" firestore:"workItemId,omitempty"`
	Version      int       `json:"v" firestore:"v"`
	SpaceID      string    `json:"spaceID" firestore:"spaceID"`
	ProjectID    string    `json:"projectID" firestore:"projectID"`
	Kind         string    `json:"kind" firestore:"kind"`
	ID           string    `json:"id" firestore:"id"`
	Revision     int64     `json:"revision" firestore:"revision"`
	Payload      []byte    `json:"payload" firestore:"payload"`
	UpdatedAt    time.Time `json:"updatedAt" firestore:"updatedAt"`
	ExpiresAt    time.Time `json:"expiresAt,omitempty" firestore:"expiresAt,omitempty"`
}

DetectiveDocument stores one bounded typed resource. Keeping each definition, Case and Run under a separate key avoids whole-State lost updates and permits direct-ID reads and bounded catalog pages.

func NewDetectiveDocumentRecord added in v0.29.1

func NewDetectiveDocumentRecord(spaceID, projectID, collection, id string) (record.Record, *DetectiveDocument)

func (DetectiveDocument) Validate added in v0.29.1

func (d DetectiveDocument) Validate(spaceID, projectID, kind, id string) error

type DetectiveQueryAcceptance added in v0.29.1

type DetectiveQueryAcceptance struct {
	Comparison    *ShippingComparisonAdmission `json:"comparison,omitempty" firestore:"comparison"`
	Manifest      *ShippingAppliedManifest     `json:"manifest,omitempty" firestore:"manifest"`
	SourcePin     *ShippingSourcePin           `json:"sourcePin,omitempty" firestore:"sourcePin"`
	Version       int                          `json:"v" firestore:"v"`
	ActorID       string                       `json:"actorID" firestore:"actorID"`
	SpaceID       string                       `json:"spaceID" firestore:"spaceID"`
	ProjectID     string                       `json:"projectID" firestore:"projectID"`
	OperationID   string                       `json:"operationID" firestore:"operationID"`
	RequestDigest string                       `json:"requestDigest" firestore:"requestDigest"`
	QueryID       string                       `json:"queryID" firestore:"queryID"`
	Revision      string                       `json:"revision" firestore:"revision"`
	SavedQuery    []byte                       `json:"savedQuery" firestore:"savedQuery"`
	AcceptedAt    time.Time                    `json:"acceptedAt" firestore:"acceptedAt"`
	ExecutionID   string                       `json:"executionID" firestore:"executionID"`
	Generation    int64                        `json:"generation" firestore:"generation"`
	LeaseUntil    time.Time                    `json:"leaseUntil" firestore:"leaseUntil"`
	Completed     bool                         `json:"completed" firestore:"completed"`
}

func NewDetectiveQueryAcceptanceRecord added in v0.29.1

func NewDetectiveQueryAcceptanceRecord(spaceID, projectID, actorID, operationID string) (record.Record, *DetectiveQueryAcceptance)

type DetectiveQuerySnapshot added in v0.29.1

type DetectiveQuerySnapshot struct {
	Comparison  *ShippingComparisonAdmission    `json:"comparison,omitempty" firestore:"comparison"`
	Pinned      *ShippingRetainedExecution      `json:"pinned,omitempty" firestore:"pinned"`
	SourcePin   *ShippingSourcePin              `json:"sourcePin,omitempty" firestore:"sourcePin"`
	Version     int                             `json:"v" firestore:"v"`
	ActorID     string                          `json:"actorID" firestore:"actorID"`
	SpaceID     string                          `json:"spaceID" firestore:"spaceID"`
	ProjectID   string                          `json:"projectID" firestore:"projectID"`
	QueryID     string                          `json:"queryID" firestore:"queryID"`
	Environment string                          `json:"environment" firestore:"environment"`
	Revision    string                          `json:"revision" firestore:"revision"`
	Fingerprint string                          `json:"fingerprint" firestore:"fingerprint"`
	Result      []byte                          `json:"result" firestore:"result"`
	Inputs      map[string]detective.InputValue `json:"inputs,omitempty" firestore:"inputs"`
	CreatedAt   time.Time                       `json:"createdAt" firestore:"createdAt"`
	ExpiresAt   time.Time                       `json:"expiresAt" firestore:"expiresAt"`
}

Hosted query receipts retain a bounded exact result for same-execution query-validator overlays. They are private to the creator and project.

type DetectiveReceipt added in v0.29.1

type DetectiveReceipt struct {
	Version       int       `json:"v" firestore:"v"`
	SpaceID       string    `json:"spaceID" firestore:"spaceID"`
	ProjectID     string    `json:"projectID" firestore:"projectID"`
	ActorID       string    `json:"actorID" firestore:"actorID"`
	OperationID   string    `json:"operationID" firestore:"operationID"`
	Action        string    `json:"action" firestore:"action"`
	RequestDigest string    `json:"requestDigest" firestore:"requestDigest"`
	Response      []byte    `json:"response" firestore:"response"`
	CreatedAt     time.Time `json:"createdAt" firestore:"createdAt"`
}

DetectiveReceipt binds an idempotent operation to its verified actor, exact project, action and canonical request digest. It is committed with the resource and audit event, so a response-loss retry cannot replay a mutation.

func NewDetectiveReceiptRecord added in v0.29.1

func NewDetectiveReceiptRecord(spaceID, projectID, actorID, operationID string) (record.Record, *DetectiveReceipt)

func (DetectiveReceipt) MatchesReplay added in v0.29.1

func (r DetectiveReceipt) MatchesReplay(spaceID, projectID, actorID, operationID, action, digest string) bool

MatchesReplay applies Core's scope/actor/action/payload idempotency guard to the adapter's private receipt before any stored response can be returned.

type DetectiveRootAcceptance added in v0.59.1

type DetectiveRootAcceptance struct {
	Version          int                                        `json:"version" firestore:"version"`
	CheckID          string                                     `json:"checkId" firestore:"checkId"`
	Environment      string                                     `json:"environment" firestore:"environment"`
	Source           *ShippingSourcePin                         `json:"source,omitempty" firestore:"source"`
	Associations     []IncidentNativeAssociation                `json:"associations" firestore:"associations"`
	Inputs           map[string]detective.InputValue            `json:"inputs" firestore:"inputs"`
	ManifestRef      string                                     `json:"manifestRef,omitempty" firestore:"manifestRef"`
	Definition       sessioncontext.DetectiveCheckDefinitionPin `json:"definition" firestore:"definition"`
	DefinitionDigest string                                     `json:"definitionDigest" firestore:"definitionDigest"`
	ServerStartedAt  time.Time                                  `json:"serverStartedAt" firestore:"serverStartedAt"`
	Criterion        *incidents.ResolutionCriterion             `json:"criterion,omitempty" firestore:"criterion"`
}

Retained at FIRST acceptance, before execution, irrespective of outcome, caller label, criterion existence or root version. Never exposed as proof.

type DetectiveRunAcceptance added in v0.29.1

type DetectiveRunAcceptance struct {
	Root     *DetectiveRootAcceptance `json:"root,omitempty" firestore:"root"`
	Manifest *ShippingAppliedManifest `json:"manifest,omitempty" firestore:"manifest"`
	// SessionFence is trusted native ownership, never decoded from an action.
	SessionFence       *sessioncontext.DetectiveFence    `json:"sessionFence,omitempty" firestore:"sessionFence"`
	SessionPinRedacted bool                              `json:"sessionPinRedacted,omitempty" firestore:"sessionPinRedacted"`
	SessionPin         *sessioncontext.DetectiveInputPin `json:"sessionPin,omitempty" firestore:"sessionPin"`
	ProducedRun        string                            `json:"producedRun,omitempty" firestore:"producedRun"`
	ProducedSnapshots  []string                          `json:"producedSnapshots,omitempty" firestore:"producedSnapshots"`

	Version           int                               `json:"v" firestore:"v"`
	SpaceID           string                            `json:"spaceID" firestore:"spaceID"`
	ProjectID         string                            `json:"projectID" firestore:"projectID"`
	ActorID           string                            `json:"actorID" firestore:"actorID"`
	OperationID       string                            `json:"operationID" firestore:"operationID"`
	RequestDigest     string                            `json:"requestDigest" firestore:"requestDigest"`
	CaseContextDigest string                            `json:"caseContextDigest,omitempty" firestore:"caseContextDigest"`
	AcceptedQueries   map[string]DetectiveAcceptedQuery `json:"acceptedQueries,omitempty" firestore:"acceptedQueries"`
	RunID             string                            `json:"runID" firestore:"runID"`
	Generation        int64                             `json:"generation" firestore:"generation"`
	LeaseUntil        time.Time                         `json:"leaseUntil" firestore:"leaseUntil"`
	Completed         bool                              `json:"completed" firestore:"completed"`
}

RunAcceptance is the durable lease around external execution. It has no input values for ordinary runs. Trusted session runs additionally retain the immutable private pin; public receipts and audit remain metadata-only. A stale worker cannot finalize after another accepted generation takes over.

func NewDetectiveRunAcceptanceRecord added in v0.29.1

func NewDetectiveRunAcceptanceRecord(spaceID, projectID, actorID, operationID string) (record.Record, *DetectiveRunAcceptance)

type EnvironmentExpectedFile added in v0.59.1

type EnvironmentExpectedFile struct {
	OID  string
	Mode string
	Size int64
}

EnvironmentOperation is private actor-bound evidence. Expiry changes replay status; the record is retained as a tombstone for the lifetime of the project.

type EnvironmentOperation added in v0.59.1

type EnvironmentOperation struct {
	ExpectedTree  map[string]EnvironmentExpectedFile `json:"expectedTree,omitempty" firestore:"expectedTree,omitempty"`
	Version       int                                `json:"v" firestore:"v"`
	ActorID       string                             `json:"actorID" firestore:"actorID"`
	Scope         dto.EnvironmentScope               `json:"scope" firestore:"scope"`
	Binding       string                             `json:"binding" firestore:"binding"`
	Result        dto.EnvironmentOperationResult     `json:"result" firestore:"result"`
	ExpectedHead  string                             `json:"expectedHead,omitempty" firestore:"expectedHead,omitempty"`
	CommittedHead string                             `json:"committedHead,omitempty" firestore:"committedHead,omitempty"`
	Changes       map[string][]byte                  `json:"changes,omitempty" firestore:"changes,omitempty"`
	ProofCursor   string                             `json:"proofCursor,omitempty" firestore:"proofCursor,omitempty"`
}

func NewEnvironmentOperationRecord added in v0.59.1

func NewEnvironmentOperationRecord(actorID, operationID string) (record.Record, *EnvironmentOperation)

type Favorite added in v0.59.1

type Favorite struct {
	Type      string    `json:"type" firestore:"type"`
	ID        string    `json:"id" firestore:"id"`
	CreatedAt time.Time `json:"createdAt" firestore:"createdAt"`
}

func (Favorite) Key added in v0.59.1

func (f Favorite) Key() string

func (Favorite) Validate added in v0.59.1

func (f Favorite) Validate() error

type FavoriteProject added in v0.59.1

type FavoriteProject struct {
	StoreID    string `json:"storeId" firestore:"storeId"`
	ProjectID  string `json:"projectId" firestore:"projectId"`
	SpaceID    string `json:"spaceID,omitempty" firestore:"spaceID,omitempty"`
	ProjectAPI string `json:"projectApi,omitempty" firestore:"projectApi,omitempty"`
	Branch     string `json:"branch,omitempty" firestore:"branch,omitempty"`
}

FavoriteProject is a target selector, never evidence of project access. Branch and transport are part of identity: a favorite cannot cross authorities.

func (FavoriteProject) Key added in v0.59.1

func (p FavoriteProject) Key() string

func (FavoriteProject) Validate added in v0.59.1

func (p FavoriteProject) Validate() error

type Favorites added in v0.59.1

type Favorites struct {
	Project FavoriteProject     `json:"project" firestore:"project"`
	Items   map[string]Favorite `json:"items" firestore:"items"`
	// This index stays in the existing owner-only document. It is never part
	// of a public response or proof of target authority. Readers still inspect
	// Items, including legacy documents that predate the index.
	ReferenceVersion int      `json:"referenceVersion,omitempty" firestore:"referenceVersion,omitempty"`
	ReferenceKeys    []string `json:"referenceKeys,omitempty" firestore:"referenceKeys,omitempty"`
}

Favorites groups one user's bookmarks for one exact project in the single users/{uid}/ext/datatug/favorites collection. A bounded document permits an atomic set/remove without an index, scan, or update to the shared user index.

func NewFavoritesRecord added in v0.59.1

func NewFavoritesRecord(userID string, project FavoriteProject) (record.Record, *Favorites)

func (*Favorites) RefreshReferenceIndex added in v0.60.0

func (f *Favorites) RefreshReferenceIndex()

func (*Favorites) ValidateReferenceIndex added in v0.60.0

func (f *Favorites) ValidateReferenceIndex() error

type GitHubCreateSource added in v0.14.0

type GitHubCreateSource struct {
	Project        *GitHubProjectCloneSource `json:"project,omitempty" firestore:"project,omitempty"`
	Binding        GitHubProjectBinding      `json:"binding" firestore:"binding"`
	ExpectedHead   string                    `json:"expectedHead" firestore:"expectedHead"`
	TemplateID     string                    `json:"templateID" firestore:"templateID"`
	TemplateCommit string                    `json:"templateCommit" firestore:"templateCommit"`
	CIEnabled      bool                      `json:"ciEnabled,omitempty" firestore:"ciEnabled,omitempty"`
	SetupDigest    string                    `json:"setupDigest,omitempty" firestore:"setupDigest,omitempty"`
}

type GitHubProjectBinding added in v0.14.0

type GitHubProjectBinding struct {
	RepositoryID int64  `json:"repositoryID" firestore:"repositoryID"`
	Owner        string `json:"owner" firestore:"owner"`
	Name         string `json:"name" firestore:"name"`
	Folder       string `json:"folder" firestore:"folder"`
	Branch       string `json:"branch" firestore:"branch"`
}

GitHubProjectBinding is the immutable repository identity and project path. Owner/name are checked against GitHub on every request; they are never authority by themselves. Branch is the initially selected working branch.

func (GitHubProjectBinding) Validate added in v0.14.0

func (b GitHubProjectBinding) Validate() error

type GitHubProjectCloneSource added in v0.59.1

type GitHubProjectCloneSource struct {
	Kind         string `json:"kind" firestore:"kind"`
	RepositoryID int64  `json:"repositoryID" firestore:"repositoryID"`
	Owner        string `json:"owner" firestore:"owner"`
	Name         string `json:"name" firestore:"name"`
	Folder       string `json:"folder" firestore:"folder"`
	Branch       string `json:"branch" firestore:"branch"`
	Commit       string `json:"commit" firestore:"commit"`
	Tree         string `json:"tree" firestore:"tree"`
}

GitHubCreateSource fixes the selected repository, branch head and pinned template in the admission receipt. Provider credentials are never included.

type GitHubProjectCreateOperation added in v0.14.0

type GitHubProjectCreateOperation struct {
	Version        int                  `firestore:"v"`
	ActorID        string               `firestore:"actorID"`
	OperationID    string               `firestore:"operationID"`
	SpaceID        string               `firestore:"spaceID"`
	ProjectID      string               `firestore:"projectID"`
	RequestDigest  string               `firestore:"requestDigest"`
	Binding        GitHubProjectBinding `firestore:"binding"`
	ExpectedHead   string               `firestore:"expectedHead"`
	CommittedHead  string               `firestore:"committedHead,omitempty"`
	TemplateID     string               `firestore:"templateID"`
	TemplateCommit string               `firestore:"templateCommit"`
	SetupPR        GitHubProjectSetupPR `firestore:"setupPR,omitempty"`
	SetupFiles     map[string][]byte    `firestore:"setupFiles,omitempty"`
	SetupDigest    string               `firestore:"setupDigest,omitempty"`
	Status         string               `firestore:"status"`
	CreatedAt      time.Time            `firestore:"createdAt"`
}

GitHubProjectCreateOperation is server-only saga evidence. It binds a client operation ID to one actor, Space, payload and expected Git head before the provider write. A committed-but-not-finalized result can be reconciled; an uncertain outcome never releases quota or starts another commit blindly.

func NewGitHubProjectCreateOperationRecord added in v0.14.0

func NewGitHubProjectCreateOperationRecord(actorID, operationID string) (record.Record, *GitHubProjectCreateOperation)

The operation key is actor-wide, rather than Space/project scoped. Reusing one ID for a different Space, repository, branch or payload is detectable.

func (GitHubProjectCreateOperation) Match added in v0.14.0

func (o GitHubProjectCreateOperation) Match(actorID, operationID, spaceID, digest string) error

func (GitHubProjectCreateOperation) Validate added in v0.14.0

func (o GitHubProjectCreateOperation) Validate() error

type GitHubProjectLocator added in v0.14.0

type GitHubProjectLocator struct {
	Version      int       `firestore:"v"`
	RepositoryID int64     `firestore:"repositoryID"`
	Folder       string    `firestore:"folder"`
	SpaceID      string    `firestore:"spaceID"`
	ProjectID    string    `firestore:"projectID"`
	Status       string    `firestore:"status"`
	CreatedAt    time.Time `firestore:"createdAt"`
}

GitHubProjectLocator is a private uniqueness pointer, not a grant or a project. Its key is derived from immutable repository ID plus folder, so a repository rename cannot create a second shared project in another Space. The referenced shared project and its admission remain Space bounded.

func NewGitHubProjectLocatorRecord added in v0.14.0

func NewGitHubProjectLocatorRecord(repositoryID int64, folder string) (record.Record, *GitHubProjectLocator)

func (GitHubProjectLocator) Validate added in v0.14.0

func (l GitHubProjectLocator) Validate() error

type GitHubProjectSetupPR added in v0.59.1

type GitHubProjectSetupPR struct {
	Number       int64  `firestore:"number" json:"number"`
	URL          string `firestore:"url" json:"url"`
	HeadBranch   string `firestore:"headBranch" json:"headBranch"`
	BaseBranch   string `firestore:"baseBranch" json:"baseBranch"`
	Commit       string `firestore:"commit" json:"commit"`
	RepositoryID int64  `firestore:"repositoryID" json:"repositoryID"`
}

func (GitHubProjectSetupPR) Validate added in v0.59.1

func (p GitHubProjectSetupPR) Validate() error

type GitHubQueryOperation added in v0.14.0

type GitHubQueryOperation struct {
	Version       int                   `firestore:"v"`
	ActorID       string                `firestore:"actorID"`
	OperationID   string                `firestore:"operationID"`
	RequestDigest string                `firestore:"requestDigest"`
	SpaceID       string                `firestore:"spaceID,omitempty"`
	ProjectID     string                `firestore:"projectID,omitempty"`
	BodyChanged   bool                  `firestore:"bodyChanged,omitempty"`
	RepositoryID  int64                 `firestore:"repositoryID"`
	Folder        string                `firestore:"folder"`
	Branch        string                `firestore:"branch"`
	ExpectedHead  string                `firestore:"expectedHead"`
	QueryPath     string                `firestore:"queryPath"`
	CommittedHead string                `firestore:"committedHead,omitempty"`
	Result        dto.SaveQueryResponse `firestore:"result"`
	CreatedAt     time.Time             `firestore:"createdAt"`
}

GitHubQueryOperation records a server-only, actor-wide intent before any provider write. A retry can prove its exact commit and recover its result.

func NewGitHubQueryOperationRecord added in v0.14.0

func NewGitHubQueryOperationRecord(actorID, operationID string) (record.Record, *GitHubQueryOperation)

func (GitHubQueryOperation) Validate added in v0.14.0

func (o GitHubQueryOperation) Validate() error

type IncidentNativeAssociation added in v0.59.1

type IncidentNativeAssociation struct {
	SpaceID     string `json:"spaceID" firestore:"spaceID"`
	ProjectID   string `json:"projectID" firestore:"projectID"`
	IncidentRef string `json:"incidentRef" firestore:"incidentRef"`
}

Private association retains native identity; hosted Incident project hashes must never replace the native Check/ResolutionScope project identity.

type NativeSemanticApplicable added in v0.59.1

type NativeSemanticApplicable struct {
	Queries []NativeSemanticSuggestion      `json:"queries"`
	Checks  []NativeSemanticCheckSuggestion `json:"checks"`
}

type NativeSemanticBrowseRequest added in v0.59.1

type NativeSemanticBrowseRequest struct {
	NativeSemanticScope
	SchemaToken string `json:"schemaToken"`
	Collection  string `json:"collection"`
}

type NativeSemanticCheckSuggestion added in v0.59.1

type NativeSemanticCheckSuggestion struct {
	Title            string                          `json:"title"`
	ID               string                          `json:"id"`
	Revision         string                          `json:"revision"`
	DefinitionDigest string                          `json:"definitionDigest"`
	Ready            bool                            `json:"ready"`
	Bindings         map[string]detective.InputValue `json:"bindings"`
	Preflight        detective.BindingPreflight      `json:"preflight"`
}

NativeSemanticCheckSuggestion proves binding applicability only. Neither Ready nor preflight grants execution/source access or predicts an outcome. Revision is the actual saved Check version as a canonical decimal string. DefinitionDigest identifies the full canonical admitted executable closure.

type NativeSemanticCollection added in v0.59.1

type NativeSemanticCollection struct {
	Name        string                     `json:"name"`
	Kind        string                     `json:"kind"`
	Columns     []NativeSemanticColumn     `json:"columns"`
	PrimaryKey  *NativeSemanticKey         `json:"primaryKey,omitempty"`
	ForeignKeys []NativeSemanticForeignKey `json:"foreignKeys"`
}

type NativeSemanticColumn added in v0.59.1

type NativeSemanticColumn struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	Nullable bool   `json:"nullable"`
}

type NativeSemanticForeignKey added in v0.59.1

type NativeSemanticForeignKey struct {
	Columns           []string `json:"columns"`
	Collection        string   `json:"collection"`
	ReferencedColumns []string `json:"referencedColumns"`
}

type NativeSemanticKey added in v0.59.1

type NativeSemanticKey struct {
	Columns []string `json:"columns"`
}

type NativeSemanticLookup added in v0.59.1

type NativeSemanticLookup struct {
	SourceID   string              `json:"sourceId"`
	Collection string              `json:"collection"`
	Column     string              `json:"column"`
	Kind       semantic.LookupKind `json:"kind"`
	Via        string              `json:"via"`
}

type NativeSemanticMappingRequest added in v0.59.1

type NativeSemanticMappingRequest struct {
	NativeSemanticSelectionRequest
	OperationID string `json:"operationId"`
	EntityID    string `json:"entityId"`
	FieldID     string `json:"fieldId"`
	IfMatch     string `json:"ifMatch"`
}

type NativeSemanticRelated added in v0.59.1

type NativeSemanticRelated struct {
	Selection   NativeSemanticSelection `json:"selection"`
	Lookups     []NativeSemanticLookup  `json:"lookups"`
	Unsupported []string                `json:"unsupported"`
}

type NativeSemanticRelatedReadRequest added in v0.59.1

type NativeSemanticRelatedReadRequest struct {
	NativeSemanticSelectionRequest
	Lookup NativeSemanticLookup `json:"lookup"`
}

type NativeSemanticResolution added in v0.59.1

type NativeSemanticResolution struct {
	Column     string                 `json:"column"`
	Value      apicontract.TypedValue `json:"value"`
	Entity     string                 `json:"entity,omitempty"`
	Field      string                 `json:"field,omitempty"`
	Provenance semantic.Provenance    `json:"provenance,omitempty"`
	Rule       string                 `json:"rule,omitempty"`
}

type NativeSemanticRow added in v0.59.1

type NativeSemanticRow struct {
	RowToken string                   `json:"rowToken"`
	Cells    []apicontract.TypedValue `json:"cells"`
}

type NativeSemanticRows added in v0.59.1

type NativeSemanticRows struct {
	SchemaToken string                 `json:"schemaToken"`
	Collection  string                 `json:"collection"`
	Columns     []NativeSemanticColumn `json:"columns"`
	Rows        []NativeSemanticRow    `json:"rows"`
	Truncated   bool                   `json:"truncated"`
}

type NativeSemanticSchema added in v0.59.1

type NativeSemanticSchema struct {
	SchemaToken string                     `json:"schemaToken"`
	Source      NativeSemanticSource       `json:"source"`
	Collections []NativeSemanticCollection `json:"collections"`
}

type NativeSemanticScope added in v0.59.1

type NativeSemanticScope struct {
	SpaceID     string                  `json:"spaceID"`
	ProjectID   string                  `json:"projectId"`
	Environment string                  `json:"environment"`
	SourceID    string                  `json:"sourceId"`
	Evidence    ShippingEvidenceRequest `json:"evidence"`
}

type NativeSemanticSelection added in v0.59.1

type NativeSemanticSelection struct {
	SchemaToken string `json:"schemaToken"`
	Collection  string `json:"collection"`
	RowToken    string `json:"rowToken"`
	Column      string `json:"column"`
}

type NativeSemanticSelectionRequest added in v0.59.1

type NativeSemanticSelectionRequest struct {
	NativeSemanticScope
	Selection NativeSemanticSelection `json:"selection"`
}

type NativeSemanticSource added in v0.59.1

type NativeSemanticSource struct {
	SourceID        string `json:"sourceId"`
	Environment     string `json:"environment"`
	Generation      string `json:"generation"`
	Revision        int    `json:"revision"`
	SHA256          string `json:"sha256"`
	BindingRevision int64  `json:"bindingRevision"`
	SchemaSHA256    string `json:"schemaSHA256"`
}

NativeSemanticSource is observed current identity, never a submitted grant.

type NativeSemanticSuggestion added in v0.59.1

type NativeSemanticSuggestion struct {
	ID                string                                 `json:"id"`
	Revision          string                                 `json:"revision"`
	Ready             bool                                   `json:"ready"`
	Bindings          map[string]apicontract.TypedValueOrSet `json:"bindings"`
	MissingInputs     []string                               `json:"missingInputs"`
	UnsupportedReason string                                 `json:"unsupportedReason,omitempty"`
}

Query Ready describes admitted parameter binding, never a predicted execution or passing outcome. Unsupported proof stays false.

type PaidMoneyMonth added in v0.5.0

type PaidMoneyMonth struct {
	V                   int    `json:"v" firestore:"v"`
	Mode                string `json:"mode" firestore:"mode"`
	AccountID           string `json:"accountId" firestore:"accountId"`
	PeriodID            string `json:"periodId" firestore:"periodId"`
	BasisRevision       int64  `json:"basisRevision" firestore:"basisRevision"`
	BasisMicroEUR       int64  `json:"basisMicroEUR" firestore:"basisMicroEUR"`
	SettledMicroEUR     int64  `json:"settledMicroEUR" firestore:"settledMicroEUR"`
	OutstandingMicroEUR int64  `json:"outstandingMicroEUR" firestore:"outstandingMicroEUR"`
	Frozen              bool   `json:"frozen" firestore:"frozen"`
}

PaidMoneyMonth matches the core paid-month fields. Core's published allocator/admission release must verify this shape before host binding.

type PlanApplication added in v0.5.0

type PlanApplication struct {
	V                             int      `json:"v" firestore:"v"`
	Mode                          string   `json:"mode" firestore:"mode"`
	Family                        string   `json:"family" firestore:"family"`
	AccountID                     string   `json:"accountId" firestore:"accountId"`
	OwnerSubscriptionID           string   `json:"ownerSubscriptionId" firestore:"ownerSubscriptionId"`
	OwnerGeneration               int64    `json:"ownerGeneration" firestore:"ownerGeneration"`
	SubscriptionRevision          int64    `json:"subscriptionRevision" firestore:"subscriptionRevision"`
	EffectDigest                  string   `json:"effectDigest" firestore:"effectDigest"`
	BasisVersion                  int64    `json:"basisVersion" firestore:"basisVersion"`
	BasisPeriods                  []string `json:"basisPeriods" firestore:"basisPeriods"`
	LimitsVersion                 string   `json:"limitsVersion,omitempty" firestore:"limitsVersion,omitempty"`
	LastFullEffectSubscriptionID  string   `json:"lastFullEffectSubscriptionId,omitempty" firestore:"lastFullEffectSubscriptionId,omitempty"`
	LastFullEffectOwnerGeneration int64    `json:"lastFullEffectOwnerGeneration,omitempty" firestore:"lastFullEffectOwnerGeneration,omitempty"`
	LastFullEffectRevision        int64    `json:"lastFullEffectRevision,omitempty" firestore:"lastFullEffectRevision,omitempty"`
	LastFullEffectQuoteKey        string   `json:"lastFullEffectQuoteKey,omitempty" firestore:"lastFullEffectQuoteKey,omitempty"`
	LastProSubscriptionID         string   `json:"lastProSubscriptionId,omitempty" firestore:"lastProSubscriptionId,omitempty"`
	LastProOwnerGeneration        int64    `json:"lastProOwnerGeneration,omitempty" firestore:"lastProOwnerGeneration,omitempty"`
	LastProQuoteKey               string   `json:"lastProQuoteKey,omitempty" firestore:"lastProQuoteKey,omitempty"`
	LastProPlanID                 string   `json:"lastProPlanId,omitempty" firestore:"lastProPlanId,omitempty"`
	LastProPaidServiceProofID     string   `json:"lastProPaidServiceProofId,omitempty" firestore:"lastProPaidServiceProofId,omitempty"`
	// These values come only from the verified payment effect's explicit grants,
	// never the limits resolver's legacy config fallback. Zero means unproved.
	LastProProtectedProjects     int64 `json:"lastProProtectedProjects,omitempty" firestore:"lastProProtectedProjects,omitempty"`
	LastProProtectedProjectUsers int64 `json:"lastProProtectedProjectUsers,omitempty" firestore:"lastProProtectedProjectUsers,omitempty"`
}

PlanApplication is private replay and last-actual-plan-write provenance. Latest applied revision may be basis-only, unlike the last Pro plan write.

type PlanLimits added in v0.4.0

type PlanLimits struct {
	Contributors          int64    `json:"contributors" firestore:"contributors"`
	ProjectGuests         int64    `json:"projectGuests" firestore:"projectGuests"`
	ProjectContributors   *int64   `json:"projectContributors,omitempty" firestore:"projectContributors,omitempty"`
	ProtectedProjects     *int64   `json:"protectedProjects,omitempty" firestore:"protectedProjects,omitempty"`
	ProtectedProjectUsers *int64   `json:"protectedProjectUsers,omitempty" firestore:"protectedProjectUsers,omitempty"`
	AIQuestions           int64    `json:"aiQuestions" firestore:"aiQuestions"`
	AIModelClasses        []string `json:"aiModelClasses" firestore:"aiModelClasses"`
	AIPaysFor             string   `json:"aiPaysFor" firestore:"aiPaysFor"`
}

PlanLimits is the version-1 allowance carried by a paid plan or a response. A Free allowance comes from host configuration, never from a stored plan.

type PlanRecord added in v0.4.0

type PlanRecord struct {
	V                int         `json:"v" firestore:"v"`
	Plan             string      `json:"plan" firestore:"plan"`
	Status           string      `json:"status" firestore:"status"`
	Period           string      `json:"period" firestore:"period"`
	PaidUntil        *time.Time  `json:"paidUntil,omitempty" firestore:"paidUntil,omitempty"`
	EndsAt           *time.Time  `json:"endsAt,omitempty" firestore:"endsAt,omitempty"`
	EndedReason      string      `json:"endedReason,omitempty" firestore:"endedReason,omitempty"`
	Founding         bool        `json:"founding" firestore:"founding"`
	Limits           *PlanLimits `json:"limits,omitempty" firestore:"limits,omitempty"`
	AIExtraQuestions int64       `json:"aiExtraQuestions,omitempty" firestore:"aiExtraQuestions,omitempty"`
	UpdatedAt        *time.Time  `json:"updatedAt,omitempty" firestore:"updatedAt,omitempty"`
}

PlanRecord is the version-1 plan/current document. Test-mode reconciliation writes plan/test instead; readers of live entitlements never use that path.

type PostmortemAction added in v0.59.1

type PostmortemAction struct {
	CriteriaAccepted    bool                        `json:"criteriaAccepted,omitempty"`
	Target              *WorkTarget                 `json:"target,omitempty"`
	TargetVersion       string                      `json:"targetVersion,omitempty"`
	SpaceID             string                      `json:"spaceID"`
	ProjectID           string                      `json:"projectID"`
	ItemID              string                      `json:"itemId"`
	OperationID         string                      `json:"operationId"`
	ExpectedVersion     int64                       `json:"expectedVersion"`
	Action              string                      `json:"action"`
	Draft               *PostmortemDraft            `json:"draft,omitempty"`
	ProposalID          string                      `json:"proposalId,omitempty"`
	Proposal            *PostmortemRecommendation   `json:"proposal,omitempty"`
	Decision            string                      `json:"decision,omitempty"`
	Rationale           string                      `json:"rationale,omitempty"`
	CandidateID         string                      `json:"candidateId,omitempty"`
	Publication         *PostmortemPublicationDraft `json:"publication,omitempty"`
	ApprovedDigest      string                      `json:"approvedDigest,omitempty"`
	PreviewAcknowledged bool                        `json:"previewAcknowledged,omitempty"`
	PublicationID       string                      `json:"publicationId,omitempty"`
	LinkID              string                      `json:"linkId,omitempty"`
	ExpiresAt           *time.Time                  `json:"expiresAt,omitempty"`
	Token               string                      `json:"token,omitempty"`
	Recipients          []string                    `json:"recipients,omitempty"`
	EarlyDraft          bool                        `json:"earlyDraft,omitempty"`
}

type PostmortemCandidate added in v0.59.1

type PostmortemCandidate struct {
	Provider        string               `json:"provider"`
	Model           string               `json:"model"`
	ActorID         string               `json:"actorId"`
	RequestDigest   string               `json:"requestDigest"`
	ID              string               `json:"id"`
	WorkItemID      string               `json:"workItemId"`
	ExpectedVersion int64                `json:"expectedVersion"`
	Draft           PostmortemDraft      `json:"draft"`
	Evidence        []PostmortemEvidence `json:"evidence"`
	InputDigest     string               `json:"inputDigest"`
	CreatedAt       time.Time            `json:"createdAt"`
}

type PostmortemCapabilities added in v0.59.1

type PostmortemCapabilities struct {
	CanReconcile bool `json:"canReconcile"`
	CanApprove   bool `json:"canApprove"`
	CanPublish   bool `json:"canPublish"`
	CanShare     bool `json:"canShare"`
}

type PostmortemDecision added in v0.59.1

type PostmortemDecision struct {
	State     string    `json:"state"`
	ActorID   string    `json:"actorId"`
	At        time.Time `json:"at"`
	Revision  int64     `json:"revision"`
	Rationale string    `json:"rationale,omitempty"`
}

type PostmortemDependency added in v0.59.1

type PostmortemDependency struct {
	NativeID   string `json:"nativeId"`
	ProposalID string `json:"proposalId"`
	Revision   int64  `json:"revision"`
}

type PostmortemDetail added in v0.59.1

type PostmortemDetail struct {
	PromotionState      string                  `json:"promotionState,omitempty"`
	PromotionProposalID string                  `json:"promotionProposalId,omitempty"`
	Work                WorkDetail              `json:"work"`
	Report              PostmortemReport        `json:"report"`
	Capabilities        PostmortemCapabilities  `json:"capabilities"`
	Publications        []PostmortemPublication `json:"publications"`
	Links               []PostmortemLink        `json:"links"`
	Token               string                  `json:"token,omitempty"`
	Candidate           *PostmortemCandidate    `json:"candidate,omitempty"`
	SendStatus          string                  `json:"sendStatus,omitempty"`
}

type PostmortemDraft added in v0.59.1

type PostmortemDraft struct {
	Sections        []PostmortemSection        `json:"sections"`
	Recommendations []PostmortemRecommendation `json:"recommendations"`
}

type PostmortemEvidence added in v0.59.1

type PostmortemEvidence struct {
	ID            string    `json:"id"`
	Kind          string    `json:"kind"`
	SourceID      string    `json:"sourceId"`
	SourceVersion int64     `json:"sourceVersion"`
	Digest        string    `json:"digest"`
	CapturedAt    time.Time `json:"capturedAt"`
	Summary       string    `json:"summary"`
	Availability  string    `json:"availability"`
}
type PostmortemLink struct {
	ID            string    `json:"id"`
	WorkItemID    string    `json:"workItemId"`
	PublicationID string    `json:"publicationId"`
	TokenHash     string    `json:"-"`
	ExpiresAt     time.Time `json:"expiresAt"`
	Revoked       bool      `json:"revoked"`
	CreatedAt     time.Time `json:"createdAt"`
}

type PostmortemPublication added in v0.59.1

type PostmortemPublication struct {
	ID         string                     `json:"id"`
	WorkItemID string                     `json:"workItemId"`
	Revision   int64                      `json:"revision"`
	Digest     string                     `json:"digest"`
	Content    PostmortemPublicationDraft `json:"content"`
	ApprovedBy string                     `json:"approvedBy"`
	CreatedAt  time.Time                  `json:"createdAt"`
}

type PostmortemPublicationDraft added in v0.59.1

type PostmortemPublicationDraft struct {
	Sections           []PostmortemSection `json:"sections"`
	SafeCitationLabels []string            `json:"safeCitationLabels"`
	ProposalSummaries  []string            `json:"proposalSummaries"`
}

type PostmortemRecommendation added in v0.59.1

type PostmortemRecommendation struct {
	ValidationIssues []string               `json:"validationIssues,omitempty"`
	ID               string                 `json:"id"`
	Kind             string                 `json:"kind"`
	Revision         int64                  `json:"revision"`
	State            string                 `json:"state"`
	DTO              json.RawMessage        `json:"dto"`
	Dependencies     []PostmortemDependency `json:"dependencies"`
	EvidenceIDs      []string               `json:"evidenceIds"`
	Rationale        string                 `json:"rationale"`
	Decisions        []PostmortemDecision   `json:"decisions"`
	Target           *WorkTarget            `json:"target,omitempty"`
	TargetVersion    string                 `json:"targetVersion,omitempty"`
	SaveState        string                 `json:"saveState,omitempty"`
}

type PostmortemReport added in v0.59.1

type PostmortemReport struct {
	WorkItemID string               `json:"workItemId"`
	Revision   int64                `json:"revision"`
	Digest     string               `json:"digest"`
	Draft      PostmortemDraft      `json:"draft"`
	Evidence   []PostmortemEvidence `json:"evidence"`
	AuthorID   string               `json:"authorId"`
	At         time.Time            `json:"at"`
	Origin     string               `json:"origin"`
	ApprovedBy string               `json:"approvedBy,omitempty"`
	ApprovedAt *time.Time           `json:"approvedAt,omitempty"`
}

type PostmortemSection added in v0.59.1

type PostmortemSection struct {
	Name           string   `json:"name"`
	Text           string   `json:"text"`
	Classification string   `json:"classification"`
	EvidenceIDs    []string `json:"evidenceIds"`
}

type Project

type Project struct {
	// LinkageRevision fences project↔Space relationship edits independently of metadata.
	LinkageRevision int64 `json:"linkageRevision,omitempty" firestore:"linkageRevision,omitempty"`
	// QueryFolders retains explicit declarations, including empty copied folders.
	QueryFolders map[string]string        `json:"queryFolders,omitempty" firestore:"queryFolders,omitempty"`
	CloneSource  *CloudProjectCloneSource `json:"cloneSource,omitempty" firestore:"cloneSource,omitempty"`
	// CloneFiles retains verified pinned declarative inputs. The public reader
	// normalizes meaning-use URIs to the pinned commit before these are stored.
	// It is compressed JSON (path -> bytes), retained without lossy DTO conversion.
	// Public summaries deliberately omit it.
	CloneFiles []byte `json:"cloneFiles,omitempty" firestore:"cloneFiles,omitempty"`
	// ConnectionCatalog is "own" on a project created by create_cloud_project:
	// connection_catalog then serves Connections instead of the pinned demo
	// catalog. Absent means a legacy Space project.
	ConnectionCatalog string `json:"connectionCatalog,omitempty" firestore:"connectionCatalog,omitempty"`
	// Connections maps a pinned catalog entry id to that entry's JSON, copied
	// verbatim from demo-db.json. Entries never carry credentials.
	Connections map[string]string `json:"connections,omitempty" firestore:"connections,omitempty"`
	// ConnectionsRevision is the optimistic-concurrency revision of Connections.
	ConnectionsRevision int64 `json:"connectionsRevision,omitempty" firestore:"connectionsRevision,omitempty"`
	// DedicatedSpace marks a project whose Space was created for it. Only
	// create_cloud_project sets it; a project without it never causes its
	// Space to be deleted.
	DedicatedSpace bool `json:"dedicatedSpace,omitempty" firestore:"dedicatedSpace,omitempty"`

	Coordination              *datatug.WatchCoordination   `json:"coordination,omitempty" firestore:"coordination,omitempty"`
	CoordinationByEnvironment map[string]WatchCoordination `json:"coordinationByEnvironment,omitempty" firestore:"coordinationByEnvironment,omitempty"`

	// Preserve canonical environment metadata through lifecycle serializers that
	// read and replace this existing project DTO.
	EnvironmentOrder      []string               `json:"environmentOrder,omitempty" firestore:"environmentOrder"`
	EnvironmentGeneration int64                  `json:"environmentGeneration,omitempty" firestore:"environmentGeneration"`
	EnvironmentIndex      []dto.EnvironmentBrief `json:"environmentIndex,omitempty" firestore:"environmentIndex"`
	Title                 string                 `json:"title" firestore:"title"`
	Access                string                 `json:"access,omitempty" firestore:"access,omitempty"`
	UserIDs               []string               `json:"userIDs,omitempty" firestore:"userIDs,omitempty"`
	Created               *Created               `json:"created,omitempty" firestore:"created,omitempty"`
	Storage               string                 `json:"storage,omitempty" firestore:"storage,omitempty"`
	Status                string                 `json:"status,omitempty" firestore:"status,omitempty"`
	GitHub                *GitHubProjectBinding  `json:"github,omitempty" firestore:"github,omitempty"`
	// Archived is set while the project is archived: kept intact, set aside in lists.
	Archived *Created `json:"archived,omitempty" firestore:"archived,omitempty"`
	// CloudProjectSharing holds the share-and-join state of a cloud project.
	CloudProjectSharing
}

func NewProjectRecord

func NewProjectRecord(projectID string) (record.Record, *Project)

NewProjectRecord wraps a fresh Project in its dalgo record, returning both the record (for database calls) and the DBO (to populate fields on).

func NewSharedProjectRecord added in v0.10.0

func NewSharedProjectRecord(spaceID, projectID string) (record.Record, *Project)

NewSharedProjectRecord reuses the existing Project DTO without a private userIDs ownership list. The canonical Space path is its ownership binding.

func (*Project) IsCloudProject added in v0.60.6

func (p *Project) IsCloudProject() bool

IsCloudProject reports whether the project was created by create_cloud_project: only that command sets the own connection catalog.

type ProjectAdmission added in v0.11.0

type ProjectAdmission struct {
	OwnerContact                                                                  ProjectOwnerContactProof `json:"ownerContact,omitempty" firestore:"ownerContact,omitempty"`
	Version                                                                       int                      `firestore:"v"`
	Mode, Product, PayerID, ActorID, SpaceID, ProjectID, CommandID, RequestDigest string
	LimitsVersion, SubscriptionID                                                 string
	ProfileVersion, QuotaBasisDigest                                              string
	ProtectedProjectsLimit, ProtectedUsersLimit, QuotaRevision                    int64
	OwnerGeneration                                                               int64
	CreatedAt                                                                     time.Time
	// Version 2 is reserved for a proved Business Space service. Its explicit
	// unlimited grants cannot be inferred from absent finite Pro limits.
	ServiceID, PlanID, PaidServiceProofID string
	OwnerRevision                         int64
	UnlimitedProjects, UnlimitedContacts  bool
}

ProjectAdmission is immutable attribution for future write/AI enforcement. It does not grant membership, included guest AI, or local execution authority.

func NewProjectAdmissionRecord added in v0.11.0

func NewProjectAdmissionRecord(space, project string) (record.Record, *ProjectAdmission)

func (ProjectAdmission) Validate added in v0.11.0

func (a ProjectAdmission) Validate() error

type ProjectBrief

type ProjectBrief struct {
	// SpaceID, ProjectID and Role are set on the brief of a Space project.
	SpaceID   string `json:"spaceID,omitempty" firestore:"spaceID,omitempty"`
	ProjectID string `json:"projectID,omitempty" firestore:"projectID,omitempty"`
	Role      string `json:"role,omitempty" firestore:"role,omitempty"`

	Title string `json:"title" firestore:"title"`
	// Storage is the id of the store holding the project: FirestoreStoreID or GithubStoreID.
	Storage    string `json:"storage,omitempty" firestore:"storage,omitempty"`
	Access     string `json:"access,omitempty" firestore:"access,omitempty"`
	ProjectAPI string `json:"projectApi,omitempty" firestore:"projectApi,omitempty"`
	Branch     string `json:"branch,omitempty" firestore:"branch,omitempty"`
	Archived   bool   `json:"archived,omitempty" firestore:"archived,omitempty"`
}

ProjectBrief is a brief of one project in a user's DataTug index.

type ProjectConnectionSaveReceipt added in v0.60.6

type ProjectConnectionSaveReceipt struct {
	Version       int                         `json:"v" firestore:"v"`
	ActorID       string                      `json:"actorID" firestore:"actorID"`
	SpaceID       string                      `json:"spaceID" firestore:"spaceID"`
	ProjectID     string                      `json:"projectID" firestore:"projectID"`
	OperationID   string                      `json:"operationID" firestore:"operationID"`
	RequestDigest string                      `json:"requestDigest" firestore:"requestDigest"`
	Result        ProjectConnectionSaveResult `json:"result" firestore:"result"`
	CreatedAt     time.Time                   `json:"createdAt" firestore:"createdAt"`
}

ProjectConnectionSaveReceipt is immutable save_connection command evidence.

func NewProjectConnectionSaveReceiptRecord added in v0.60.6

func NewProjectConnectionSaveReceiptRecord(spaceID, projectID, actorID, operationID string) (record.Record, *ProjectConnectionSaveReceipt)

NewProjectConnectionSaveReceiptRecord keys a receipt by actor and operation id under spaces/{spaceID}/ext/datatug/projects/{projectID}.

type ProjectConnectionSaveResult added in v0.60.6

type ProjectConnectionSaveResult struct {
	ConnectionID        string `json:"connectionID" firestore:"connectionID"`
	ConnectionsRevision int64  `json:"connectionsRevision" firestore:"connectionsRevision"`
}

ProjectConnectionSaveResult is the response of save_connection, stored in its receipt so an identical retry returns it unchanged.

type ProjectOwnerContactProof added in v0.12.0

type ProjectOwnerContactProof struct {
	Version        int                                    `json:"v,omitempty" firestore:"v,omitempty"`
	Contact        contract4linkage.RelationshipEntityRef `json:"contact" firestore:"contact"`
	Role           string                                 `json:"role,omitempty" firestore:"role,omitempty"`
	CatalogVersion string                                 `json:"catalogVersion,omitempty" firestore:"catalogVersion,omitempty"`
}

ProjectOwnerContactProof is immutable paid-create provenance, not another membership list. The actual assignment lives only in the Related graph. Ownerless historical admissions require a separately reviewed migration.

func (ProjectOwnerContactProof) Present added in v0.12.0

func (p ProjectOwnerContactProof) Present() bool

func (ProjectOwnerContactProof) Validate added in v0.12.0

func (p ProjectOwnerContactProof) Validate() error

type ProjectQuotaLimit added in v0.11.0

type ProjectQuotaLimit struct {
	Unlimited bool
	Count     int64
}

ProjectQuotaLimit distinguishes an explicit unlimited grant from absent data. Current Pro admission derives a finite limit from its frozen paid grants.

func (ProjectQuotaLimit) Allows added in v0.11.0

func (l ProjectQuotaLimit) Allows(allocated int64) bool

func (ProjectQuotaLimit) Validate added in v0.11.0

func (l ProjectQuotaLimit) Validate() error

type ProjectRoleCatalogData added in v0.15.0

type ProjectRoleCatalogData struct {
	Version uint16                  `json:"version"`
	Roles   []ProjectRoleDefinition `json:"roles"`
}

func ProjectRoleCatalog added in v0.15.0

func ProjectRoleCatalog() ProjectRoleCatalogData

ProjectRoleCatalog returns the versioned product role catalog. A fresh slice prevents callers from mutating the canonical definitions used by policy.

type ProjectRoleDefinition added in v0.15.0

type ProjectRoleDefinition struct {
	ID                   ProjectRoleID `json:"id"`
	Name                 string        `json:"name"`
	CanBrowse            bool          `json:"canBrowse"`
	CanRunQueries        bool          `json:"canRunQueries"`
	CanEditLocally       bool          `json:"canEditLocally"`
	CanSaveShared        bool          `json:"canSaveShared"`
	CanManageAssignments bool          `json:"canManageAssignments"`
}

ProjectRoleDefinition is the product-owned permission description for a project contact role. Platform and paid-plan guards still apply to each action represented here.

type ProjectRoleID added in v0.15.0

type ProjectRoleID string

ProjectRoleID is a stable role assigned to a contact linked to a standalone DataTug project. These roles are separate from the containing Space roles.

type ProtectedProjectQuota added in v0.11.0

type ProtectedProjectQuota struct {
	Version                             int `firestore:"v"`
	Mode, Product, PayerID, BasisDigest string
	Allocated, Revision                 int64
}

ProtectedProjectQuota retains allocation count across renewals and Space boundaries. Missing records never mean zero. BasisDigest identifies a proved complete empty/imported inventory, not an operator assertion or billing term.

func NewProtectedProjectQuotaRecord added in v0.11.0

func NewProtectedProjectQuotaRecord(mode, product, payer string) (record.Record, *ProtectedProjectQuota)

func (ProtectedProjectQuota) Validate added in v0.11.0

func (q ProtectedProjectQuota) Validate() error

type QueryActivityContext added in v0.20.0

type QueryActivityContext struct {
	Version            int                               `firestore:"v"`
	ContextID          string                            `firestore:"contextID"`
	ActorID            string                            `firestore:"actorID"`
	SpaceID            string                            `firestore:"spaceID"`
	ProjectID          string                            `firestore:"projectID"`
	Period             contract4paymentus.UsagePeriodRef `firestore:"period"`
	PeriodStartUTC     time.Time                         `firestore:"periodStartUTC"`
	PeriodEndUTC       time.Time                         `firestore:"periodEndUTC"`
	PaidUntilUTC       time.Time                         `firestore:"paidUntilUTC"`
	BindingDigest      string                            `firestore:"bindingDigest"`
	PayerBindingDigest string                            `firestore:"payerBindingDigest"`
	PaidBindingProofID string                            `firestore:"paidBindingProofID"`
	QueryUseProofID    string                            `firestore:"queryUseProofID"`
	IssuedAtUTC        time.Time                         `firestore:"issuedAtUTC"`
	ExpiresAtUTC       time.Time                         `firestore:"expiresAtUTC"`
}

QueryActivityContext is private server state. It freezes the first-party reporter, project, paid service, and original metering window without retaining query content or client-supplied financial facts.

func NewQueryActivityContextRecord added in v0.20.0

func NewQueryActivityContextRecord(spaceID, contextID string) (record.Record, *QueryActivityContext)

func (QueryActivityContext) Validate added in v0.20.0

func (c QueryActivityContext) Validate() error

type QueryActivityContextQuota added in v0.20.0

type QueryActivityContextQuota struct {
	Version               int                               `firestore:"v"`
	ActorID               string                            `firestore:"actorID"`
	Period                contract4paymentus.UsagePeriodRef `firestore:"period"`
	ContextWindowStartUTC time.Time                         `firestore:"contextWindowStartUTC"`
	ContextsInWindow      int64                             `firestore:"contextsInWindow"`
	ReportWindowStartUTC  time.Time                         `firestore:"reportWindowStartUTC"`
	ReportsInWindow       int64                             `firestore:"reportsInWindow"`
}

func NewQueryActivityContextQuotaRecord added in v0.20.0

func NewQueryActivityContextQuotaRecord(actorID string, period contract4paymentus.UsagePeriodRef) (record.Record, *QueryActivityContextQuota)

func (QueryActivityContextQuota) Validate added in v0.20.0

func (q QueryActivityContextQuota) Validate() error

type QueryActivityDrainCursor added in v0.23.2

type QueryActivityDrainCursor struct {
	Version      int                     `firestore:"v"`
	Mode         contract4paymentus.Mode `firestore:"mode"`
	SpaceID      string                  `firestore:"spaceID"`
	AfterID      string                  `firestore:"afterID,omitempty"`
	UpdatedAtUTC time.Time               `firestore:"updatedAtUTC"`
}

QueryActivityDrainCursor is Space-scoped operational state. It records a paginated scan position and never authorizes activity or affects billing.

func NewQueryActivityDrainCursorRecord added in v0.23.2

func NewQueryActivityDrainCursorRecord(mode contract4paymentus.Mode, spaceID string) (record.Record, *QueryActivityDrainCursor)

func (QueryActivityDrainCursor) Validate added in v0.23.2

func (c QueryActivityDrainCursor) Validate() error

type QueryActivityKind added in v0.20.0

type QueryActivityKind string
const (
	QueryActivityEdit                QueryActivityKind = "query_edit"
	QueryActivityExecutionDispatched QueryActivityKind = "query_execution_dispatched"
)

func (QueryActivityKind) Valid added in v0.20.0

func (k QueryActivityKind) Valid() bool

type QueryActivityPending added in v0.20.0

type QueryActivityPending struct {
	Version             int                               `firestore:"v"`
	ReceiptID           string                            `firestore:"receiptID"`
	SpaceID             string                            `firestore:"spaceID"`
	Period              contract4paymentus.UsagePeriodRef `firestore:"period"`
	Activity            contract4paymentus.UsageActivity  `firestore:"activity"`
	Sequence            int64                             `firestore:"sequence,omitempty"`
	DeliveryProofDigest string                            `firestore:"deliveryProofDigest,omitempty"`
	DeliveredAtUTC      time.Time                         `firestore:"deliveredAtUTC,omitempty"`
	DeliveryState       string                            `firestore:"deliveryState" json:"deliveryState"`
	Attempts            int64                             `firestore:"attempts"`
	UpdatedAtUTC        time.Time                         `firestore:"updatedAtUTC"`
}

QueryActivityPending is the durable outbox item. It is updated in place and remains until the ledger admits the activity or its closed-period inbox records it, so a crash after ledger commit is safely replayable.

func NewQueryActivityPendingRecord added in v0.20.0

func NewQueryActivityPendingRecord(spaceID, receiptID string) (record.Record, *QueryActivityPending)

func (QueryActivityPending) Validate added in v0.20.0

func (p QueryActivityPending) Validate() error

type QueryActivityPeriodCheckpoint added in v0.23.1

type QueryActivityPeriodCheckpoint struct {
	Version           int                                    `firestore:"v"`
	Period            contract4paymentus.UsagePeriodRef      `firestore:"period"`
	Snapshot          contract4paymentus.UsagePeriodSnapshot `firestore:"snapshot"`
	AnchorUTC         time.Time                              `firestore:"anchorUTC"`
	AnchorProofDigest string                                 `firestore:"anchorProofDigest"`
	State             string                                 `firestore:"state"`
	CloseRequest      contract4paymentus.UsageCloseRequest   `firestore:"closeRequest,omitempty"`
	AcceptedCount     int64                                  `firestore:"acceptedCount"`
	DeliveredThrough  int64                                  `firestore:"deliveredThrough"`
	UpdatedAtUTC      time.Time                              `firestore:"updatedAtUTC"`
}

QueryActivityPeriodCheckpoint is the explicit completeness fence for one anchored Business usage period. A missing record is never interpreted as an empty period. The checkpoint is prepared before Paymentus.Open and becomes ready only after that ledger operation and a same-transaction read confirm the exact stored snapshot.

func NewQueryActivityPeriodCheckpointRecord added in v0.23.1

func NewQueryActivityPeriodCheckpointRecord(period contract4paymentus.UsagePeriodRef) (record.Record, *QueryActivityPeriodCheckpoint)

func (QueryActivityPeriodCheckpoint) Validate added in v0.23.1

func (c QueryActivityPeriodCheckpoint) Validate() error

type QueryActivityPeriodSequence added in v0.23.1

type QueryActivityPeriodSequence struct {
	Version             int                               `firestore:"v"`
	Period              contract4paymentus.UsagePeriodRef `firestore:"period"`
	Sequence            int64                             `firestore:"sequence"`
	ReceiptID           string                            `firestore:"receiptID"`
	ActivityDigest      string                            `firestore:"activityDigest"`
	DeliveryState       string                            `firestore:"deliveryState"`
	DeliveryProofDigest string                            `firestore:"deliveryProofDigest,omitempty"`
	DeliveredAtUTC      time.Time                         `firestore:"deliveredAtUTC,omitempty"`
}

QueryActivityPeriodSequence maps a period-local accepted sequence to its immutable receipt. Delivery proof is recorded only after Paymentus admits the exact activity or the correction inbox durably retains it.

func NewQueryActivityPeriodSequenceRecord added in v0.23.1

func NewQueryActivityPeriodSequenceRecord(period contract4paymentus.UsagePeriodRef, sequence int64) (record.Record, *QueryActivityPeriodSequence)

func (QueryActivityPeriodSequence) Validate added in v0.23.1

func (s QueryActivityPeriodSequence) Validate() error

type QueryActivityReceipt added in v0.20.0

type QueryActivityReceipt struct {
	Version            int                               `firestore:"v"`
	ReceiptID          string                            `firestore:"receiptID"`
	ContextID          string                            `firestore:"contextID"`
	OperationID        string                            `firestore:"operationID"`
	Kind               QueryActivityKind                 `firestore:"kind"`
	ActorID            string                            `firestore:"actorID"`
	SpaceID            string                            `firestore:"spaceID"`
	ProjectID          string                            `firestore:"projectID"`
	Period             contract4paymentus.UsagePeriodRef `firestore:"period"`
	PeriodStartUTC     time.Time                         `firestore:"periodStartUTC"`
	PeriodEndUTC       time.Time                         `firestore:"periodEndUTC"`
	PaidUntilUTC       time.Time                         `firestore:"paidUntilUTC"`
	Activity           contract4paymentus.UsageActivity  `firestore:"activity"`
	BindingDigest      string                            `firestore:"bindingDigest"`
	PayerBindingDigest string                            `firestore:"payerBindingDigest"`
	PaidBindingProofID string                            `firestore:"paidBindingProofID"`
	QueryUseProofID    string                            `firestore:"queryUseProofID"`
	AcceptedAtUTC      time.Time                         `firestore:"acceptedAtUTC"`
	StructuralDigest   string                            `firestore:"structuralDigest"`
}

QueryActivityReceipt coalesces the first qualifying reported action for one actor and canonical payer/service period. ContextID, OperationID and Kind are the immutable operation binding; the structural digest contains only server-derived facts, never query text, results, or request data.

func NewQueryActivityReceiptRecord added in v0.20.0

func NewQueryActivityReceiptRecord(actorID string, period contract4paymentus.UsagePeriodRef) (record.Record, *QueryActivityReceipt)

func (QueryActivityReceipt) Validate added in v0.20.0

func (r QueryActivityReceipt) Validate() error

type QueryEditCandidate added in v0.18.0

type QueryEditCandidate struct {
	Version        int       `firestore:"v"`
	SourceID       string    `firestore:"sourceID"`
	EventID        string    `firestore:"eventID"`
	ActorID        string    `firestore:"actorID"`
	OperationID    string    `firestore:"operationID"`
	SpaceID        string    `firestore:"spaceID"`
	ProjectID      string    `firestore:"projectID"`
	RepositoryID   int64     `firestore:"repositoryID"`
	Folder         string    `firestore:"folder"`
	ExpectedHead   string    `firestore:"expectedHead"`
	QueryPath      string    `firestore:"queryPath"`
	BodyChanged    bool      `firestore:"bodyChanged"`
	Classification string    `firestore:"classification"`
	AcceptedAtUTC  time.Time `firestore:"acceptedAtUTC"`
}

QueryEditCandidate is private, server-accepted evidence of a changed query body submitted by an authorized actor. It is unclassified for billing: a provider failure, stale later commit, or abandoned save does not promote it. Query text and text-derived digests are deliberately absent.

func NewQueryEditCandidateRecord added in v0.18.0

func NewQueryEditCandidateRecord(spaceID, actorID, operationID string) (record.Record, *QueryEditCandidate)

func (QueryEditCandidate) Validate added in v0.18.0

func (c QueryEditCandidate) Validate() error

type SharedEnvironmentMetadata added in v0.59.1

type SharedEnvironmentMetadata struct {
	EnvironmentOrder      []string               `json:"environmentOrder" firestore:"environmentOrder"`
	EnvironmentGeneration int64                  `json:"environmentGeneration" firestore:"environmentGeneration"`
	EnvironmentIndex      []dto.EnvironmentBrief `json:"environmentIndex" firestore:"environmentIndex"`
}

SharedEnvironmentMetadata projects only the safe, transactionally maintained fields on the project root; callers patch these fields instead of replacing it.

func NewSharedEnvironmentMetadataRecord added in v0.59.1

func NewSharedEnvironmentMetadataRecord(spaceID, projectID string) (record.Record, *SharedEnvironmentMetadata)

type SharedLinkedProject added in v0.12.0

type SharedLinkedProject struct {
	Project
	contract4linkage.WithRelatedAndIDs
	// ProjectLifecycleEpoch is a server-owned opaque incarnation. It is minted
	// on every supported managed-project creation and advanced only by an
	// actual archive/restore transition. It is never derived from timestamps or
	// caller data, and ordinary metadata edits leave it stable.
	ProjectLifecycleEpoch string `json:"projectLifecycleEpoch,omitempty" firestore:"projectLifecycleEpoch,omitempty"`
}

SharedLinkedProject reuses Linkage's persisted graph at the existing shared project key. Legacy private Project/UserIDs remain unchanged; shared access never derives from that legacy list.

func NewSharedLinkedProjectRecord added in v0.12.0

func NewSharedLinkedProjectRecord(space, project string) (record.Record, *SharedLinkedProject)

func (*SharedLinkedProject) InitializeProjectLifecycleEpoch added in v0.63.0

func (p *SharedLinkedProject) InitializeProjectLifecycleEpoch() error

InitializeProjectLifecycleEpoch mints the opaque incarnation once. No-op callers (reads, repeated archive/restore, unrelated edits) must not call it. An existing nonempty value is still canonical-validated, never silently accepted as malformed evidence.

func (*SharedLinkedProject) RotateProjectLifecycleEpoch added in v0.63.0

func (p *SharedLinkedProject) RotateProjectLifecycleEpoch() error

RotateProjectLifecycleEpoch advances the opaque incarnation for a genuine archive/restore transition. It refuses to overwrite malformed nonempty evidence and always mints a value different from the prior epoch.

type SharedProjectCreateReceipt added in v0.10.0

type SharedProjectCreateReceipt struct {
	CloneSource   *CloudProjectCloneSource `json:"cloneSource,omitempty" firestore:"cloneSource,omitempty"`
	OwnerContact  ProjectOwnerContactProof `json:"ownerContact,omitempty" firestore:"ownerContact,omitempty"`
	Version       int                      `json:"v" firestore:"v"`
	ActorID       string                   `json:"actorID" firestore:"actorID"`
	SpaceID       string                   `json:"spaceID" firestore:"spaceID"`
	CommandID     string                   `json:"commandID" firestore:"commandID"`
	Title         string                   `json:"title" firestore:"title"`
	RequestDigest string                   `json:"requestDigest" firestore:"requestDigest"`
	ProjectID     string                   `json:"projectID" firestore:"projectID"`
	CreatedAt     time.Time                `json:"createdAt" firestore:"createdAt"`
	PayerID       string                   `json:"payerID,omitempty" firestore:"payerID,omitempty"`
	Mode          string                   `json:"mode,omitempty" firestore:"mode,omitempty"`
	Product       string                   `json:"product,omitempty" firestore:"product,omitempty"`
	GitHub        *GitHubCreateSource      `json:"github,omitempty" firestore:"github,omitempty"`
	// Deleted marks the receipt of a project that was deleted. The receipt is
	// kept, so a replayed create reports the deletion instead of creating the
	// project again, and it carries the resumable purge's progress.
	Deleted *SharedProjectDeletion `json:"deleted,omitempty" firestore:"deleted,omitempty"`
}

SharedProjectCreateReceipt is immutable, private command evidence. It is not a project index, a module-enablement record, or a billing entitlement.

func NewSharedProjectCreateReceiptRecord added in v0.10.0

func NewSharedProjectCreateReceiptRecord(spaceID, commandID string) (record.Record, *SharedProjectCreateReceipt)

func (SharedProjectCreateReceipt) Validate added in v0.10.0

func (r SharedProjectCreateReceipt) Validate() error

type SharedProjectDeletion added in v0.60.6

type SharedProjectDeletion struct {
	At      time.Time `json:"at" firestore:"at"`
	ActorID string    `json:"actorID" firestore:"actorID"`
	// Title is the project title when it was deleted; a resume must confirm it.
	Title string `json:"title" firestore:"title"`
	// DedicatedSpace is the project's mark, read before the project record was
	// removed. Only a dedicated Space is revoked and deleted with the project.
	DedicatedSpace bool `json:"dedicatedSpace,omitempty" firestore:"dedicatedSpace,omitempty"`
	// Users are the project's members when it was deleted: the purge removes
	// their per-user favorites of the project.
	Users []string `json:"users,omitempty" firestore:"users,omitempty"`
	// MemberContacts are the Space contacts of a dedicated Space's non-owner
	// members still to be removed from the Space before it is deleted.
	MemberContacts []string `json:"memberContacts,omitempty" firestore:"memberContacts,omitempty"`
	// PurgeCursor names the purge target to resume from; PurgeDone is set once
	// every target was found empty.
	PurgeCursor    string `json:"purgeCursor,omitempty" firestore:"purgeCursor,omitempty"`
	PurgeDone      bool   `json:"purgeDone,omitempty" firestore:"purgeDone,omitempty"`
	InvitesRevoked bool   `json:"invitesRevoked,omitempty" firestore:"invitesRevoked,omitempty"`
	SpaceDeleted   bool   `json:"spaceDeleted,omitempty" firestore:"spaceDeleted,omitempty"`
	// Resumes counts the follow-up tasks enqueued for this delete.
	Resumes int `json:"resumes,omitempty" firestore:"resumes,omitempty"`
}

SharedProjectDeletion records the deletion of a Space-backed cloud project (first-cloud-project-endpoints REQ space-project-delete-archive).

type SharedProjectQuery added in v0.27.0

type SharedProjectQuery struct {
	CloneReadOnly bool `json:"cloneReadOnly,omitempty" firestore:"cloneReadOnly,omitempty"`
	// CloneDefinition preserves source metadata outside the current Core DTO.
	// The effective read overlays current typed fields on this immutable JSON.
	CloneDefinition string                         `json:"cloneDefinition,omitempty" firestore:"cloneDefinition,omitempty"`
	Version         int                            `json:"v" firestore:"v"`
	SpaceID         string                         `json:"spaceID" firestore:"spaceID"`
	ProjectID       string                         `json:"projectID" firestore:"projectID"`
	FolderPath      string                         `json:"folderPath" firestore:"folderPath"`
	QueryID         string                         `json:"queryID" firestore:"queryID"`
	Query           datatug.QueryDefWithFolderPath `json:"query" firestore:"query"`
	Revision        string                         `json:"revision" firestore:"revision"`
	UpdatedAt       time.Time                      `json:"updatedAt" firestore:"updatedAt"`
}

SharedProjectQuery stores a complete query definition atomically. Unlike a Git-backed project it has no branch; Revision is an opaque content revision.

func NewSharedProjectQueryRecord added in v0.27.0

func NewSharedProjectQueryRecord(spaceID, projectID, folderPath, queryID string) (record.Record, *SharedProjectQuery)

func (SharedProjectQuery) ReadJSON added in v0.61.1

func (q SharedProjectQuery) ReadJSON() (json.RawMessage, error)

ReadJSON retains unknown copied metadata while the typed current fields are authoritative. Saving an imported query cannot erase fields a newer source declared but the current Core editor does not know about.

func (*SharedProjectQuery) Validate added in v0.27.0

func (q *SharedProjectQuery) Validate() error

Validate also hydrates the native SDK's persisted numeric representation, after every invariant and the exact complete content revision have passed. Public mutation input continues to use Core's strict request validation.

type SharedProjectQuerySaveReceipt added in v0.27.0

type SharedProjectQuerySaveReceipt struct {
	Version       int                   `json:"v" firestore:"v"`
	ActorID       string                `json:"actorID" firestore:"actorID"`
	SpaceID       string                `json:"spaceID" firestore:"spaceID"`
	ProjectID     string                `json:"projectID" firestore:"projectID"`
	OperationID   string                `json:"operationID" firestore:"operationID"`
	Kind          string                `json:"kind" firestore:"kind"`
	RequestDigest string                `json:"requestDigest" firestore:"requestDigest"`
	Result        dto.SaveQueryResponse `json:"result" firestore:"result"`
	CreatedAtUTC  time.Time             `json:"createdAtUTC" firestore:"createdAtUTC"`
}

SharedProjectQuerySaveReceipt is immutable idempotency evidence. Space and project are separate fields so a receipt cannot be rebound across scopes.

func NewSharedProjectQuerySaveReceiptRecord added in v0.27.0

func NewSharedProjectQuerySaveReceiptRecord(spaceID, projectID, actorID, operationID string) (record.Record, *SharedProjectQuerySaveReceipt)

func (*SharedProjectQuerySaveReceipt) Validate added in v0.27.0

func (r *SharedProjectQuerySaveReceipt) Validate() error

type SharedProjectRef added in v0.10.0

type SharedProjectRef struct {
	StoreID   string `json:"storeId"`
	SpaceID   string `json:"spaceID"`
	ProjectID string `json:"projectId"`
}

SharedProjectRef preserves the distinction between a Space-owned project and the legacy private cloud root, even when their project IDs are equal.

type ShippingAction added in v0.59.1

type ShippingAction struct {
	SpaceID     string           `json:"spaceID"`
	ProjectID   string           `json:"projectId"`
	SourceID    string           `json:"sourceId"`
	OperationID string           `json:"operationId"`
	Action      string           `json:"action"`
	Expected    *ShippingPointer `json:"expected,omitempty"`
	OrderID     int64            `json:"orderId,omitempty"`
}

type ShippingActionResponse added in v0.59.1

type ShippingActionResponse struct {
	Receipt ShippingReceipt `json:"receipt"`
	Current ShippingPointer `json:"current"`
}

type ShippingAppliedManifest added in v0.59.1

type ShippingAppliedManifest struct {
	WorkContext []ShippingWorkContextSelection         `json:"workContext,omitempty"`
	AuditSHA256 string                                 `json:"auditSHA256"`
	Version     int                                    `json:"version"`
	Ref         string                                 `json:"ref"`
	ActorID     string                                 `json:"actorId"`
	IncidentRef string                                 `json:"incidentRef"`
	CaseID      string                                 `json:"caseId,omitempty"`
	CaseVersion int64                                  `json:"caseVersion,omitempty"`
	Session     ShippingSelectedSessionAudit           `json:"session"`
	ContextSet  ShippingSelectedContextAudit           `json:"contextSet"`
	Scope       sessioncontext.Scope                   `json:"scope"`
	Bag         ShippingSelectedBagAudit               `json:"bag"`
	Entries     []sessioncontext.EntryRef              `json:"entries"`
	Inputs      map[string]apicontract.TypedValueOrSet `json:"inputs"`
}

type ShippingArtifact added in v0.59.1

type ShippingArtifact struct {
	ID     string `json:"id" firestore:"id"`
	SHA256 string `json:"sha256" firestore:"sha256"`
	Bytes  int64  `json:"bytes" firestore:"bytes"`
}

type ShippingComparisonAdmission added in v0.59.1

type ShippingComparisonAdmission struct {
	Version       int                                    `json:"version"`
	Declaration   datatug.QueryComparison                `json:"declaration"`
	Inputs        map[string]apicontract.TypedValueOrSet `json:"inputs"`
	QueryID       string                                 `json:"queryId"`
	QueryRevision string                                 `json:"queryRevision"`
	ManifestRef   string                                 `json:"manifestRef"`
}

ShippingComparisonAdmission is a server-owned receipt-linked pair, never a client grant. Version1 freezes the Shipping observation/status/observed-start verification policy.

func (*ShippingComparisonAdmission) UnmarshalJSON added in v0.59.1

func (v *ShippingComparisonAdmission) UnmarshalJSON(data []byte) error

func (ShippingComparisonAdmission) Validate added in v0.59.1

func (v ShippingComparisonAdmission) Validate(q datatug.QueryDef, queryID, revision string, manifest ShippingAppliedManifest) error

func (ShippingComparisonAdmission) ValidateInputs added in v0.59.1

func (v ShippingComparisonAdmission) ValidateInputs(q datatug.QueryDef) error

ValidateInputs checks the exact declaration and bounded typed pair, not source truth.

type ShippingComponentDescriptor added in v0.59.1

type ShippingComponentDescriptor struct {
	ComponentID  string `json:"componentId" firestore:"componentId"`
	Version      int    `json:"version" firestore:"version"`
	Digest       string `json:"digest" firestore:"digest"`
	SourceCommit string `json:"sourceCommit" firestore:"sourceCommit"`
}

ShippingComponentDescriptor identifies an immutable definition-only bundle. Its source commit is independent of the original Demo admission TemplateCommit.

type ShippingComponentInstallRequest added in v0.59.1

type ShippingComponentInstallRequest struct {
	SpaceID         string `json:"spaceID"`
	ProjectID       string `json:"projectId"`
	SourceID        string `json:"sourceId"`
	Environment     string `json:"environment"`
	OperationID     string `json:"operationId"`
	ComponentID     string `json:"componentId"`
	Version         int    `json:"version"`
	ComponentDigest string `json:"componentDigest"`
}

type ShippingComponentInstallation added in v0.59.1

type ShippingComponentInstallation struct {
	ShippingComponentDescriptor
	ActorID     string    `json:"actorId" firestore:"actorId"`
	OperationID string    `json:"operationId" firestore:"operationId"`
	InstalledAt time.Time `json:"installedAt" firestore:"installedAt"`
	QueryIDs    []string  `json:"queryIds" firestore:"queryIds"`
	CheckIDs    []string  `json:"checkIds" firestore:"checkIds"`
	EntityIDs   []string  `json:"entityIds" firestore:"entityIds"`
	BoardIDs    []string  `json:"boardIds" firestore:"boardIds"`
}

ShippingComponentInstallation is historical installation metadata, not a current source grant or a claim that subsequently edited assets are unchanged.

type ShippingComponentState added in v0.59.1

type ShippingComponentState struct {
	Available    ShippingComponentDescriptor    `json:"available"`
	Exists       bool                           `json:"exists"`
	Installation *ShippingComponentInstallation `json:"installation,omitempty"`
}

type ShippingEvidenceBinding added in v0.59.1

type ShippingEvidenceBinding struct {
	InputName  string `json:"inputName"`
	EntryID    string `json:"entryId"`
	RevisionID string `json:"revisionId"`
}

func (*ShippingEvidenceBinding) UnmarshalJSON added in v0.59.1

func (v *ShippingEvidenceBinding) UnmarshalJSON(data []byte) error

type ShippingEvidenceContext added in v0.59.1

type ShippingEvidenceContext struct {
	SessionID              string                    `json:"sessionId"`
	ExpectedSessionVersion int64                     `json:"expectedSessionVersion"`
	ExpectedContextSetID   string                    `json:"expectedContextSetId"`
	Scope                  sessioncontext.Scope      `json:"scope"`
	Bindings               []ShippingEvidenceBinding `json:"bindings"`
}

func (*ShippingEvidenceContext) UnmarshalJSON added in v0.59.1

func (v *ShippingEvidenceContext) UnmarshalJSON(data []byte) error

type ShippingEvidenceRequest added in v0.59.1

type ShippingEvidenceRequest struct {
	Retention   string                  `json:"retention"`
	IncidentRef string                  `json:"incidentRef"`
	CaseID      string                  `json:"caseId,omitempty"`
	Context     ShippingEvidenceContext `json:"context"`
}

ShippingEvidenceRequest intentionally shares admitted executed inputs/rows with current project contacts. It never publishes arbitrary working context.

func (*ShippingEvidenceRequest) UnmarshalJSON added in v0.59.1

func (v *ShippingEvidenceRequest) UnmarshalJSON(data []byte) error

type ShippingPointer added in v0.59.1

type ShippingPointer struct {
	Generation string `json:"generation" firestore:"generation"`
	Revision   int    `json:"revision" firestore:"revision"`
	SHA256     string `json:"sha256" firestore:"sha256"`
}

type ShippingPublication added in v0.59.1

type ShippingPublication struct {
	Version       int       `json:"version" firestore:"version"`
	Environment   string    `json:"environment" firestore:"environment"`
	Revision      int64     `json:"revision" firestore:"revision"`
	Enabled       bool      `json:"enabled" firestore:"enabled"`
	FixtureCommit string    `json:"fixtureCommit" firestore:"fixtureCommit"`
	ActorID       string    `json:"actorId" firestore:"actorId"`
	At            time.Time `json:"at" firestore:"at"`
}

type ShippingPublicationReceipt added in v0.59.1

type ShippingPublicationReceipt struct {
	RequestSHA256 string              `firestore:"requestSHA256"`
	Publication   ShippingPublication `firestore:"publication"`
}

type ShippingPublicationRequest added in v0.59.1

type ShippingPublicationRequest struct {
	SpaceID          string `json:"spaceID"`
	ProjectID        string `json:"projectId"`
	SourceID         string `json:"sourceId"`
	Environment      string `json:"environment"`
	OperationID      string `json:"operationId"`
	ExpectedRevision int64  `json:"expectedRevision"`
	Enabled          bool   `json:"enabled"`
}

type ShippingPublicationState added in v0.59.1

type ShippingPublicationState struct {
	Exists      bool                       `json:"exists"`
	Publication *ShippingPublicationStatus `json:"publication,omitempty"`
}

ShippingPublicationState reports current authorized metadata, never an old receipt.

type ShippingPublicationStatus added in v0.59.1

type ShippingPublicationStatus struct {
	Revision int64 `json:"revision"`
	Enabled  bool  `json:"enabled"`
}

type ShippingReceipt added in v0.59.1

type ShippingReceipt struct {
	OperationID   string           `json:"operationId" firestore:"operationId"`
	ActorID       string           `json:"actorId" firestore:"actorId"`
	RequestSHA256 string           `json:"requestSHA256" firestore:"requestSHA256"`
	Action        string           `json:"action" firestore:"action"`
	Outcome       string           `json:"outcome" firestore:"outcome"`
	Revision      ShippingRevision `json:"revision" firestore:"revision"`
	AcceptedAt    time.Time        `json:"acceptedAt" firestore:"acceptedAt"`
}

type ShippingRetainedExecution added in v0.59.1

type ShippingRetainedExecution struct {
	OperationID     string                  `json:"operationId"`
	CheckRun        *incidents.CheckRunRef  `json:"checkRun,omitempty"`
	SourcePin       ShippingSourcePin       `json:"sourcePin"`
	Manifest        ShippingAppliedManifest `json:"manifest"`
	SavedQuery      json.RawMessage         `json:"savedQuery"`
	CheckDefinition json.RawMessage         `json:"checkDefinition,omitempty"`
}

ShippingRetainedExecution is stored in the existing snapshot owner, with no TTL. Accepted definitions, source pin and manifest remain immutable.

type ShippingRevision added in v0.59.1

type ShippingRevision struct {
	ShippingPointer
	FixtureCommit string             `json:"fixtureCommit" firestore:"fixtureCommit"`
	FixtureSHA256 string             `json:"fixtureSHA256" firestore:"fixtureSHA256"`
	SchemaSHA256  string             `json:"schemaSHA256" firestore:"schemaSHA256"`
	Configuration int64              `json:"configuration" firestore:"configuration"`
	BusinessClock string             `json:"businessClock" firestore:"businessClock"`
	Bytes         int                `json:"bytes" firestore:"bytes"`
	Artifacts     []ShippingArtifact `json:"artifacts" firestore:"artifacts"`
	ActorID       string             `json:"actorId" firestore:"actorId"`
	AcceptedAt    time.Time          `json:"acceptedAt" firestore:"acceptedAt"`
}

type ShippingSelectedBagAudit added in v0.59.1

type ShippingSelectedBagAudit struct {
	ID           string                    `json:"id"`
	SessionID    string                    `json:"sessionId"`
	Scope        sessioncontext.Scope      `json:"scope"`
	Version      int64                     `json:"version"`
	ClearVersion int64                     `json:"clearVersion"`
	Entries      []sessioncontext.EntryRef `json:"entries"`
}

type ShippingSelectedContextAudit added in v0.59.1

type ShippingSelectedContextAudit struct {
	ID        string                      `json:"id"`
	SessionID string                      `json:"sessionId"`
	Enabled   bool                        `json:"enabled"`
	Slots     []ShippingSelectedSlotAudit `json:"slots"`
}

type ShippingSelectedSessionAudit added in v0.59.1

type ShippingSelectedSessionAudit struct {
	ID                    string `json:"id"`
	DatabaseID            string `json:"databaseId"`
	ProjectID             string `json:"projectId"`
	Owner                 string `json:"owner"`
	State                 string `json:"state"`
	Version               int64  `json:"version"`
	ContextSetID          string `json:"contextSetId"`
	NativeFenceGeneration int64  `json:"nativeFenceGeneration"`
}

Selected audit projections contain provenance, never whole private working records. Native Core records remain the only context authority at capture.

type ShippingSelectedSlotAudit added in v0.59.1

type ShippingSelectedSlotAudit struct {
	Scope      sessioncontext.Scope      `json:"scope"`
	BagID      string                    `json:"bagId"`
	BagVersion int64                     `json:"bagVersion"`
	Version    int64                     `json:"version"`
	Entries    []sessioncontext.EntryRef `json:"entries"`
}

type ShippingSourcePin added in v0.59.1

type ShippingSourcePin struct {
	SpaceID         string           `json:"spaceID" firestore:"spaceID"`
	ProjectID       string           `json:"projectId" firestore:"projectId"`
	SourceID        string           `json:"sourceId" firestore:"sourceId"`
	Environment     string           `json:"environment" firestore:"environment"`
	BindingRevision int64            `json:"bindingRevision" firestore:"bindingRevision"`
	Revision        ShippingRevision `json:"revision" firestore:"revision"`
}

ShippingSourcePin is an immutable admitted source revision, independent of Detective acceptance lease generations. No client may submit this proof.

type ShippingWorkContextSelection added in v0.59.1

type ShippingWorkContextSelection struct {
	WorkItemID     string `json:"workItemId"`
	WorkVersion    int64  `json:"workVersion"`
	SessionID      string `json:"sessionId"`
	SessionVersion int64  `json:"sessionVersion"`
	BagID          string `json:"bagId"`
	BagVersion     int64  `json:"bagVersion"`
	EntryID        string `json:"entryId"`
	RevisionID     string `json:"revisionId"`
}

Canonical Work selections are audit references, never another value store. The private applied session remains the execution input authority.

type SpaceAccessBasis added in v0.63.0

type SpaceAccessBasis struct {
	Kind    string   `json:"kind"`
	SpaceID string   `json:"spaceID,omitempty"`
	Roles   []string `json:"roles"`
	State   string   `json:"state"`
}

type SpaceAccessBlocker added in v0.63.0

type SpaceAccessBlocker struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type SpaceAccessCommit added in v0.63.0

type SpaceAccessCommit struct {
	GranteeSpaceID  string            `json:"granteeSpaceID"`
	Generation      int64             `json:"generation"`
	Revision        int64             `json:"revision"`
	AdmissionCounts SpaceAccessCounts `json:"admissionCounts"`
	AuditReceipt    string            `json:"auditReceipt"`
}

type SpaceAccessContact added in v0.63.0

type SpaceAccessContact struct {
	ContactRef     SpaceAccessContactRef `json:"contactRef"`
	Title          string                `json:"title,omitempty"`
	Roles          []string              `json:"roles"`
	EffectiveRoles []string              `json:"effectiveRoles"`
	State          string                `json:"state"`
	BlockedReason  string                `json:"blockedReason,omitempty"`
}

type SpaceAccessContactRef added in v0.63.0

type SpaceAccessContactRef struct {
	SpaceID   string `json:"spaceID" firestore:"spaceID"`
	ContactID string `json:"contactID" firestore:"contactID"`
}

type SpaceAccessCounts added in v0.63.0

type SpaceAccessCounts struct {
	Eligible     int   `json:"eligible"`
	Admitted     int   `json:"admitted"`
	Blocked      int   `json:"blocked"`
	NewContacts  int   `json:"newContacts"`
	Reserved     int   `json:"reserved"`
	ContactLimit int64 `json:"contactLimit"`
	MaxCohort    int   `json:"maxCohort"`
}

type SpaceAccessDispatchTicket added in v0.63.0

type SpaceAccessDispatchTicket struct {
	ID     string
	Fenced bool
}

type SpaceAccessGrant added in v0.63.0

type SpaceAccessGrant struct {
	Roles      []string `json:"roles"`
	Generation int64    `json:"generation"`
	Revision   int64    `json:"revision"`
	State      string   `json:"state"`
}

type SpaceAccessIntent added in v0.63.0

type SpaceAccessIntent string
const (
	SpaceAccessLink            SpaceAccessIntent = "link"
	SpaceAccessSetRoles        SpaceAccessIntent = "set_roles"
	SpaceAccessClearRoles      SpaceAccessIntent = "clear_roles"
	SpaceAccessReadmit         SpaceAccessIntent = "readmit"
	SpaceAccessUnlink          SpaceAccessIntent = "unlink"
	SpaceAccessUnlinkContact   SpaceAccessIntent = "unlink_contact"
	SpaceAccessReadmitContact  SpaceAccessIntent = "readmit_contact"
	SpaceAccessSetContactRoles SpaceAccessIntent = "set_contact_roles"
)

type SpaceAccessOperation added in v0.63.0

type SpaceAccessOperation struct {
	ActorID       string
	ProjectRef    TeamProjectRef
	SourceID      string
	OperationID   string
	RequestDigest string
	RequiresWrite bool
}

SpaceAccessOperation is constructed by the trusted executing host from the verified actor and immutable native source/operation. It is not an HTTP DTO.

type SpaceAccessPreview added in v0.63.0

type SpaceAccessPreview struct {
	PreviewID      string               `json:"previewID"`
	ExpiresAt      time.Time            `json:"expiresAt"`
	GranteeSpaceID string               `json:"granteeSpaceID"`
	Roles          []string             `json:"roles"`
	Intent         SpaceAccessIntent    `json:"intent"`
	Revisions      SpaceAccessRevisions `json:"revisions"`
	Counts         SpaceAccessCounts    `json:"counts"`
	Blockers       []SpaceAccessBlocker `json:"blockers"`
	PayerKind      string               `json:"payerKind"`
	SourceCaveat   string               `json:"sourceCaveat"`
	OwnerWarning   bool                 `json:"ownerWarning"`
}

type SpaceAccessRequest added in v0.63.0

type SpaceAccessRequest struct {
	ProjectRef     TeamProjectRef         `json:"projectRef"`
	GranteeSpaceID string                 `json:"granteeSpaceID"`
	Intent         SpaceAccessIntent      `json:"intent"`
	Roles          []string               `json:"roles,omitempty"`
	ContactRef     *SpaceAccessContactRef `json:"contactRef,omitempty"`
}

func (SpaceAccessRequest) ContactIntent added in v0.63.0

func (r SpaceAccessRequest) ContactIntent() bool

func (SpaceAccessRequest) Validate added in v0.63.0

func (r SpaceAccessRequest) Validate() error

type SpaceAccessRevisions added in v0.63.0

type SpaceAccessRevisions struct {
	Project   int64  `json:"project"`
	Space     int64  `json:"space"`
	Authority string `json:"authority"`
	Policy    string `json:"policy"`
}

type SpaceAccessView added in v0.63.0

type SpaceAccessView struct {
	Contacts          []SpaceAccessContact        `json:"contacts,omitempty"`
	ProjectRef        TeamProjectRef              `json:"projectRef"`
	Spaces            map[string]SpaceAccessGrant `json:"spaces"`
	EffectiveRoles    []string                    `json:"effectiveRoles"`
	Bases             []SpaceAccessBasis          `json:"bases"`
	CanManage         bool                        `json:"canManage"`
	RecoveryQualified bool                        `json:"recoveryQualified"`
	Blockers          []SpaceAccessBlocker        `json:"blockers"`
}

type SpaceGrantAdmission added in v0.63.0

type SpaceGrantAdmission struct {
	AdmissionIdentity string `json:"admissionIdentity" firestore:"admissionIdentity"`
	GenerationIndex   string `json:"generationIndex" firestore:"generationIndex"`
	OwningSpaceID     string `json:"owningSpaceID" firestore:"owningSpaceID"`
	ProjectID         string `json:"projectID" firestore:"projectID"`
	GranteeSpaceID    string `json:"granteeSpaceID" firestore:"granteeSpaceID"`
	GrantGeneration   int64  `json:"grantGeneration" firestore:"grantGeneration"`
	// RootLifecycleEpoch binds the admission to the current native grantee
	// Space (root) incarnation. Archive/restore of that root rotates it. It is
	// part of the full tuple identity but not of the stable current-row key:
	// a lifecycle transition replaces the current payload in place.
	RootLifecycleEpoch string `json:"rootLifecycleEpoch,omitempty" firestore:"rootLifecycleEpoch,omitempty"`
	// ProjectLifecycleEpoch binds the admission to the current project
	// incarnation. It is part of the full tuple identity but deliberately not
	// part of the stable current-row key: archive/restore replaces the payload,
	// it does not create a second current row for the same contact.
	ProjectLifecycleEpoch string `json:"projectLifecycleEpoch,omitempty" firestore:"projectLifecycleEpoch,omitempty"`
	MembershipGeneration  string `json:"membershipGeneration" firestore:"membershipGeneration"`
	BindingGeneration     string `json:"bindingGeneration" firestore:"bindingGeneration"`
	ContactSpaceID        string `json:"contactSpaceID" firestore:"contactSpaceID"`
	ContactID             string `json:"contactID" firestore:"contactID"`
	State                 string `json:"state" firestore:"state"`
	// RefusalAnchorReliable records whether a suppressed/blocked decision was
	// anchored to a complete CURRENT native tuple (member/binding/root/project).
	// A legacy, missing or metadata-repaired proof is recorded as false: the
	// refusal then survives every replayed event and only an explicit Owner
	// readmission can restore the member. It is deliberately excluded from
	// Identity()/GenerationIndex so existing immutable admission identities keep
	// their meaning.
	RefusalAnchorReliable bool `json:"refusalAnchorReliable,omitempty" firestore:"refusalAnchorReliable,omitempty"`
}

Private provenance records hold no authoritative role sets. Access roles always come from the current reciprocal native project/Space graph.

func (SpaceGrantAdmission) Identity added in v0.63.0

func (a SpaceGrantAdmission) Identity() string

The document is the CURRENT row for one qualified contact in one grant generation. Epoch changes replace this payload; the full tuple identity is retained separately and every read verifies it against current native facts.

func (*SpaceGrantAdmission) Key added in v0.63.0

func (a *SpaceGrantAdmission) Key() string

func (*SpaceGrantAdmission) Seal added in v0.63.0

func (a *SpaceGrantAdmission) Seal()

type SpaceProjectListing added in v0.63.0

type SpaceProjectListing struct {
	ProjectRef     TeamProjectRef `json:"projectRef"`
	Title          string         `json:"title"`
	AccessRequired bool           `json:"accessRequired"`
}

type StoreBrief

type StoreBrief struct {
	Title    string                   `json:"title" firestore:"title"`
	Type     string                   `json:"type" firestore:"type"`
	URL      string                   `json:"url,omitempty" firestore:"url,omitempty"`
	Projects map[string]*ProjectBrief `json:"projects,omitempty" firestore:"projects,omitempty"`
}

StoreBrief is a brief of one store in a user's DataTug index.

type TeamProjectAssociation added in v0.63.0

type TeamProjectAssociation struct {
	Ref   TeamProjectRef `json:"ref" firestore:"ref"`
	Title string         `json:"title" firestore:"title"`
}

TeamProjectAssociation is owned by the team Space. The same exact project selector can appear in any number of teams without changing its ownership. Consumers must separately prove current team membership and project access; this record and its title are never authorization evidence.

func NewTeamProjectRecord added in v0.63.0

func NewTeamProjectRecord(teamID string, ref TeamProjectRef) (record.Record, *TeamProjectAssociation, error)

NewTeamProjectRecord validates selectors before constructing a key under the approved Space extension path. No global reverse index or ACL is created.

func (TeamProjectAssociation) Validate added in v0.63.0

func (a TeamProjectAssociation) Validate() error

type TeamProjectRef added in v0.63.0

type TeamProjectRef FavoriteProject

TeamProjectRef is an exact navigation selector, never a membership or access grant. SpaceID remains the project's owning Space, not the associated team. Branch and transport remain part of identity, as they are for favorites.

func (TeamProjectRef) Key added in v0.63.0

func (p TeamProjectRef) Key() string

func (TeamProjectRef) Validate added in v0.63.0

func (p TeamProjectRef) Validate() error

type UserExt

type UserExt struct {
	Stores map[string]*StoreBrief `json:"stores,omitempty" firestore:"stores,omitempty"`
}

UserExt is the DataTug extension data of one user: the index of the DataTug stores the user can see, and the project briefs inside each of them. It is the data of the users/{userID}/ext/datatug record.

func NewUserExtRecord

func NewUserExtRecord(userID, extID string) (record.Record, *UserExt)

NewUserExtRecord wraps a fresh UserExt in its dalgo record, returning both the record and the DBO.

type WatchCoordination added in v0.59.1

type WatchCoordination struct {
	Endpoint  string `json:"endpoint" firestore:"endpoint"`
	Namespace string `json:"namespace" firestore:"namespace"`
}

Project is the data stored in an ext/datatug/projects/{projectID} record.

type WorkAction added in v0.59.1

type WorkAction struct {
	EarlyDraft           bool                      `json:"earlyDraft,omitempty"`
	SpaceID              string                    `json:"spaceID"`
	ProjectID            string                    `json:"projectID"`
	OperationID          string                    `json:"operationId"`
	Action               string                    `json:"action"`
	ItemID               string                    `json:"itemId,omitempty"`
	ExpectedVersion      int64                     `json:"expectedVersion,omitempty"`
	Draft                *WorkDraft                `json:"draft,omitempty"`
	Status               string                    `json:"status,omitempty"`
	Summary              string                    `json:"summary,omitempty"`
	Outcome              string                    `json:"outcome,omitempty"`
	CriteriaAccepted     bool                      `json:"criteriaAccepted,omitempty"`
	Comment              string                    `json:"comment,omitempty"`
	Relation             string                    `json:"relation,omitempty"`
	Target               *WorkTarget               `json:"target,omitempty"`
	LinkID               string                    `json:"linkId,omitempty"`
	ParentID             string                    `json:"parentId,omitempty"`
	ParentVersion        int64                     `json:"parentVersion,omitempty"`
	Inheritance          string                    `json:"inheritance,omitempty"`
	ContextScope         *sessioncontext.Scope     `json:"contextScope,omitempty"`
	ContextCommand       *sessioncontext.Command   `json:"contextCommand,omitempty"`
	ProposalID           string                    `json:"proposalId,omitempty"`
	TargetItemID         string                    `json:"targetItemId,omitempty"`
	TargetVersion        int64                     `json:"targetVersion,omitempty"`
	SourceSessionVersion int64                     `json:"sourceSessionVersion,omitempty"`
	TargetSessionVersion int64                     `json:"targetSessionVersion,omitempty"`
	Selection            []sessioncontext.EntryRef `json:"selection,omitempty"`
}

All commands are scoped and idempotent; the HTTP boundary rejects fields not applicable to the chosen action. Principal identity is never a JSON field.

type WorkActivity added in v0.59.1

type WorkActivity struct {
	ID      string       `json:"id"`
	ItemID  string       `json:"itemId"`
	Version int64        `json:"version"`
	ActorID string       `json:"actorId"`
	Action  string       `json:"action"`
	Fields  []string     `json:"fields,omitempty"`
	Comment string       `json:"comment,omitempty"`
	Summary string       `json:"summary,omitempty"`
	Outcome string       `json:"outcome,omitempty"`
	Changes []WorkChange `json:"changes,omitempty"`
	At      time.Time    `json:"at"`
}

type WorkActivityPage added in v0.59.1

type WorkActivityPage struct {
	Items      []WorkActivity `json:"items"`
	NextCursor string         `json:"nextCursor,omitempty"`
}
type WorkArtifactLinks struct {
	Items []WorkItem `json:"items"`
	Links []WorkLink `json:"links"`
}

type WorkCapabilities added in v0.59.1

type WorkCapabilities struct {
	CanRead     bool     `json:"canRead"`
	CanCreate   bool     `json:"canCreate"`
	CanEdit     bool     `json:"canEdit"`
	CanAssign   bool     `json:"canAssign"`
	CanContext  bool     `json:"canContext"`
	Transitions []string `json:"transitions"`
}

type WorkCase added in v0.59.1

type WorkCase struct {
	LegacyCaseID string   `json:"legacyCaseId,omitempty"`
	ScenarioIDs  []string `json:"scenarioIds,omitempty"`
}

type WorkChange added in v0.59.1

type WorkChange struct {
	Field  string `json:"field"`
	Before string `json:"before"`
	After  string `json:"after"`
}

type WorkClosure added in v0.59.1

type WorkClosure struct {
	Summary string    `json:"summary"`
	ActorID string    `json:"actorId"`
	At      time.Time `json:"at"`
	Outcome string    `json:"outcome,omitempty"`
}

type WorkDetail added in v0.59.1

type WorkDetail struct {
	WatchEvidence      []WorkWatchEvidence      `json:"watchEvidence"`
	HasEarlierActivity bool                     `json:"hasEarlierActivity,omitempty"`
	Item               WorkItem                 `json:"item"`
	Links              []WorkLink               `json:"links"`
	RelatedItems       []WorkRelatedItem        `json:"relatedItems"`
	Activity           []WorkActivity           `json:"activity"`
	Members            []WorkMember             `json:"members"`
	Capabilities       WorkCapabilities         `json:"capabilities"`
	Context            *sessioncontext.Snapshot `json:"context,omitempty"`
	Environments       []WorkEnvironment        `json:"environments"`
	Proposals          []WorkProposal           `json:"proposals"`
	ExecutionSessionID string                   `json:"executionSessionId,omitempty"`
}

type WorkDraft added in v0.59.1

type WorkDraft struct {
	Type              string     `json:"type"`
	Title             string     `json:"title"`
	Description       string     `json:"description,omitempty"`
	OwnerID           string     `json:"ownerId,omitempty"`
	AssigneeIDs       []string   `json:"assigneeIds,omitempty"`
	PrimaryAssigneeID string     `json:"primaryAssigneeId,omitempty"`
	Priority          string     `json:"priority"`
	DueAt             *time.Time `json:"dueAt,omitempty"`
	Criteria          string     `json:"criteria,omitempty"`
	Severity          string     `json:"severity,omitempty"`
	Impact            string     `json:"impact,omitempty"`
	Environment       string     `json:"environment,omitempty"`
}

WorkDraft is the only create/edit payload. Server identity, lifecycle, version, timestamps and context association cannot be set through this type.

func (WorkDraft) Validate added in v0.59.1

func (d WorkDraft) Validate() error

type WorkEnvironment added in v0.59.1

type WorkEnvironment struct {
	EnvironmentID  string        `json:"environmentId"`
	IdentityDomain string        `json:"identityDomain"`
	Title          string        `json:"title"`
	Subjects       []WorkSubject `json:"subjects"`
}

type WorkIncident added in v0.59.1

type WorkIncident struct {
	Severity    string                 `json:"severity"`
	Impact      string                 `json:"impact,omitempty"`
	Environment string                 `json:"environment"`
	ReportedAt  time.Time              `json:"reportedAt"`
	DetectedAt  *time.Time             `json:"detectedAt,omitempty"`
	ResolvedAt  *time.Time             `json:"resolvedAt,omitempty"`
	LegacyRef   *incidents.IncidentRef `json:"legacyRef,omitempty"`
}

type WorkItem added in v0.59.1

type WorkItem struct {
	ID                string          `json:"id"`
	SpaceID           string          `json:"spaceID"`
	ProjectID         string          `json:"projectID"`
	Type              string          `json:"type"`
	Title             string          `json:"title"`
	Description       string          `json:"description,omitempty"`
	OwnerID           string          `json:"ownerId"`
	AssigneeIDs       []string        `json:"assigneeIds"`
	PrimaryAssigneeID string          `json:"primaryAssigneeId,omitempty"`
	Status            string          `json:"status"`
	Lifecycle         string          `json:"lifecycle"`
	Priority          string          `json:"priority"`
	DueAt             *time.Time      `json:"dueAt,omitempty"`
	Criteria          string          `json:"criteria,omitempty"`
	Closure           *WorkClosure    `json:"closure,omitempty"`
	ContextSessionID  string          `json:"contextSessionId"`
	ParentID          string          `json:"parentId,omitempty"`
	Inheritance       string          `json:"inheritance,omitempty"`
	Version           int64           `json:"version"`
	CreatedBy         string          `json:"createdBy"`
	CreatedAt         time.Time       `json:"createdAt"`
	UpdatedAt         time.Time       `json:"updatedAt"`
	Incident          *WorkIncident   `json:"incident,omitempty"`
	Case              *WorkCase       `json:"case,omitempty"`
	Postmortem        *WorkPostmortem `json:"postmortem,omitempty"`
	// PostmortemRef is the denormalised presence and review state of the one
	// postmortem attached to this incident or case. It is maintained in the
	// same transaction as the postmortem item and its report transitions.
	PostmortemRef *WorkPostmortemRef `json:"postmortemRef,omitempty"`
}

WorkItem is the sole current authority for operational work metadata. Source artefacts and immutable specialised evidence are referenced, not owned.

func (WorkItem) Overdue added in v0.59.1

func (w WorkItem) Overdue(now time.Time) bool

func (WorkItem) Participant added in v0.59.1

func (w WorkItem) Participant(actor string) bool

func (*WorkItem) Transition added in v0.59.1

func (w *WorkItem) Transition(status, summary, outcome, actor string, criteriaAccepted bool, now time.Time) error

Transition validates lifecycle only. The facade must additionally verify current roles and Incident resolution evidence in its transaction.

type WorkLink struct {
	Deleted   bool       `json:"deleted,omitempty"`
	ID        string     `json:"id"`
	SourceID  string     `json:"sourceId"`
	Relation  string     `json:"relation"`
	Target    WorkTarget `json:"target"`
	CreatedBy string     `json:"createdBy"`
	CreatedAt time.Time  `json:"createdAt"`
}

type WorkMember added in v0.59.1

type WorkMember struct {
	ID    string `json:"id"`
	Title string `json:"title"`
	Role  string `json:"role"`
}

type WorkPage added in v0.59.1

type WorkPage struct {
	Items        []WorkItem        `json:"items"`
	NextCursor   string            `json:"nextCursor,omitempty"`
	HasMore      bool              `json:"hasMore"`
	Members      []WorkMember      `json:"members"`
	Capabilities WorkCapabilities  `json:"capabilities"`
	Environments []WorkEnvironment `json:"environments"`
	// ParentBriefs carries the id, type and title of the parents referenced by
	// the returned items, so a list can show the parent without a second read.
	ParentBriefs map[string]WorkParentBrief `json:"parentBriefs,omitempty"`
}

type WorkParentBrief added in v0.59.1

type WorkParentBrief struct {
	ID    string `json:"id"`
	Type  string `json:"type"`
	Title string `json:"title"`
}

WorkParentBrief is a read-only projection of one parent Work item.

type WorkPostmortem added in v0.59.1

type WorkPostmortem struct {
	PublicationIDs   []string `json:"publicationIds,omitempty"`
	LinkIDs          []string `json:"linkIds,omitempty"`
	Revision         int64    `json:"revision"`
	ApprovedRevision int64    `json:"approvedRevision,omitempty"`
	ApprovedDigest   string   `json:"approvedDigest,omitempty"`
}

type WorkPostmortemRef added in v0.59.1

type WorkPostmortemRef struct {
	ID        string    `json:"id"`
	ParentID  string    `json:"parentId,omitempty"`
	State     string    `json:"state"`
	UpdatedAt time.Time `json:"updatedAt"`
}

WorkPostmortemRef is the parent-side projection of the attached postmortem. State is one of draft, in_review, approved, closed or published.

type WorkProposal added in v0.59.1

type WorkProposal struct {
	ID                   string                    `json:"id"`
	SourceID             string                    `json:"sourceId"`
	TargetID             string                    `json:"targetId"`
	SourceVersion        int64                     `json:"sourceVersion"`
	TargetVersion        int64                     `json:"targetVersion"`
	SourceSessionVersion int64                     `json:"sourceSessionVersion"`
	TargetSessionVersion int64                     `json:"targetSessionVersion"`
	Selection            []sessioncontext.EntryRef `json:"selection"`
	ActorID              string                    `json:"actorId"`
	State                string                    `json:"state"`
	CreatedAt            time.Time                 `json:"createdAt"`
}

type WorkRelatedItem added in v0.59.1

type WorkRelatedItem struct {
	ID    string `json:"id"`
	Type  string `json:"type"`
	Title string `json:"title"`
}

WorkRelatedItem is a read projection of current canonical metadata, never a second persisted copy of a related item's title or lifecycle.

type WorkSubject added in v0.59.1

type WorkSubject struct {
	ID      string                 `json:"id"`
	Label   string                 `json:"label"`
	Subject sessioncontext.Subject `json:"subject"`
	Type    string                 `json:"type"`
	Shape   string                 `json:"shape"`
}

type WorkTarget added in v0.59.1

type WorkTarget struct {
	Kind        string `json:"kind"`
	ID          string `json:"id"`
	StoreID     string `json:"storeId,omitempty"`
	ProjectID   string `json:"projectId,omitempty"`
	Folder      string `json:"folder,omitempty"`
	Environment string `json:"environment,omitempty"`
}

WorkTarget preserves source scope; an ID alone is not an artefact identity.

type WorkWatchAction added in v0.59.1

type WorkWatchAction struct {
	SpaceID         string     `json:"spaceID"`
	ProjectID       string     `json:"projectID"`
	OperationID     string     `json:"operationId"`
	Action          string     `json:"action"`
	WatchID         string     `json:"watchId"`
	EventID         string     `json:"eventId,omitempty"`
	SharePersonal   bool       `json:"sharePersonal"`
	Draft           *WorkDraft `json:"draft,omitempty"`
	ItemID          string     `json:"itemId,omitempty"`
	ExpectedVersion int64      `json:"expectedVersion,omitempty"`
}

type WorkWatchContextEntry added in v0.59.1

type WorkWatchContextEntry struct {
	Name      string                       `json:"name"`
	Label     string                       `json:"label"`
	SubjectID string                       `json:"subjectId"`
	Subject   sessioncontext.Subject       `json:"subject"`
	Type      string                       `json:"type"`
	Value     sessioncontext.ValueEnvelope `json:"value"`
}

type WorkWatchContextPreview added in v0.59.1

type WorkWatchContextPreview struct {
	RequiresSharing bool                    `json:"requiresSharing"`
	EventID         string                  `json:"eventId"`
	Scope           sessioncontext.Scope    `json:"scope"`
	Entries         []WorkWatchContextEntry `json:"entries"`
	Omitted         []string                `json:"omitted"`
}

type WorkWatchDefinition added in v0.59.1

type WorkWatchDefinition struct {
	WorkCheckID  string                `json:"workCheckId,omitempty"`
	ID           string                `json:"id"`
	Namespace    string                `json:"namespace"`
	Project      string                `json:"project"`
	Environment  string                `json:"environment"`
	Version      int64                 `json:"version"`
	Title        string                `json:"title"`
	Owner        string                `json:"owner"`
	Visibility   string                `json:"visibility"`
	CheckID      string                `json:"checkId"`
	CheckVersion string                `json:"checkVersion,omitempty"`
	Mode         string                `json:"mode"`
	Lifecycle    string                `json:"lifecycle"`
	Enabled      bool                  `json:"enabled"`
	Observation  *WorkWatchObservation `json:"observation,omitempty"`
}

type WorkWatchDelivery added in v0.59.1

type WorkWatchDelivery struct {
	ID        string    `json:"id"`
	EventID   string    `json:"eventId,omitempty"`
	WatchID   string    `json:"watchId"`
	Channel   string    `json:"channel"`
	State     string    `json:"state"`
	Attempts  int       `json:"attempts"`
	CreatedAt time.Time `json:"createdAt"`
}

type WorkWatchEvent added in v0.59.1

type WorkWatchEvent struct {
	ID                string    `json:"id"`
	Namespace         string    `json:"namespace"`
	Project           string    `json:"project"`
	Environment       string    `json:"environment"`
	WatchID           string    `json:"watchId"`
	RunID             string    `json:"runId"`
	DefinitionVersion int64     `json:"definitionVersion"`
	Title             string    `json:"title"`
	Kind              string    `json:"kind"`
	Previous          string    `json:"previous"`
	Outcome           string    `json:"outcome"`
	OccurredAt        time.Time `json:"occurredAt"`
	CheckID           string    `json:"checkId"`
	CheckVersion      string    `json:"checkVersion,omitempty"`
	SourceFingerprint string    `json:"sourceFingerprint,omitempty"`
	CheckRunRef       string    `json:"checkRunRef,omitempty"`
}

WorkWatchEvent is safe evidence metadata. Native input values never enter activity or relationship projections; explicitly allowed values use Context.

type WorkWatchEvidence added in v0.59.1

type WorkWatchEvidence struct {
	ID              string         `json:"id"`
	ItemID          string         `json:"itemId"`
	WatchID         string         `json:"watchId"`
	Event           WorkWatchEvent `json:"event"`
	ImportedAt      time.Time      `json:"importedAt"`
	ImportedBy      string         `json:"importedBy"`
	SharedBy        string         `json:"sharedBy,omitempty"`
	ContextEntryIDs []string       `json:"contextEntryIds"`
}

type WorkWatchNotification added in v0.59.1

type WorkWatchNotification struct {
	ID        string    `json:"id"`
	EventID   string    `json:"eventId,omitempty"`
	WatchID   string    `json:"watchId"`
	RunID     string    `json:"runId"`
	Title     string    `json:"title"`
	Event     string    `json:"event"`
	CreatedAt time.Time `json:"createdAt"`
	ReadAt    time.Time `json:"readAt,omitempty"`
}

type WorkWatchObservation added in v0.59.1

type WorkWatchObservation struct {
	Value          string    `json:"value"`
	LastKnown      string    `json:"lastKnown"`
	LastRunID      string    `json:"lastRunId,omitempty"`
	LastObservedAt time.Time `json:"lastObservedAt,omitempty"`
	Availability   string    `json:"availability"`
}

type WorkWatchView added in v0.59.1

type WorkWatchView struct {
	Deliveries    []WorkWatchDelivery       `json:"deliveries"`
	Notifications []WorkWatchNotification   `json:"notifications"`
	Watches       []WorkWatchDefinition     `json:"watches"`
	Events        []WorkWatchEvent          `json:"events"`
	LinkedItems   []WorkItem                `json:"linkedItems"`
	Contexts      []WorkWatchContextPreview `json:"contexts"`
	Members       []WorkMember              `json:"members"`
	Capabilities  WorkCapabilities          `json:"capabilities"`
	Environments  []WorkEnvironment         `json:"environments"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL