Capture actual project work sources before reuse

Why: Project retrieval hits, tool results, and saved visible analysis must be individually traceable and fully analyzed before later project actions consume them.

Evidence: RED tests first showed missing run-source capture, tool-result capture, and run-wide preflight; go test -p 1 ./... and go build ./... passed; isolated PostgreSQL source, migration, audit, and context tests passed.

Impact: Persist actual run-bound sources with current-status checks and exact manifests behind the disabled X3 assembly gate; no live product path, migration, deployment, or release is enabled.

Refs: TT-N03, TT-R01; approved X3 stage-five plan r1
This commit is contained in:
weichen
2026-10-14 16:25:22 +00:00
parent 928da87a93
commit 7cee124b8f
11 changed files with 692 additions and 47 deletions
+21 -20
View File
@@ -12,26 +12,27 @@ import (
// Actor, ProjectID, source identity, or the source authorization epoch.
// RunID may be empty for a newly committed user message or chat command.
type WorkObservation struct {
EventID string `json:"eventId"`
Phase string `json:"phase"`
Actor string `json:"actor"`
Owner string `json:"owner"`
ProjectID core.ID `json:"projectId"`
ConversationID core.ID `json:"conversationId,omitempty"`
RunID core.ID `json:"runId,omitempty"`
SourceKind string `json:"sourceKind"`
SourceID string `json:"sourceId"`
SourceVersion string `json:"sourceVersion"`
SourceSHA256 string `json:"sourceSha256"`
PartIndex int `json:"partIndex"`
SpanStart int `json:"spanStart"` // UTF-8 byte offset in the exact source
SpanEnd int `json:"spanEnd"`
Text string `json:"text,omitempty"` // only the actual authorized fragment
Scope string `json:"scope"` // private|project|controlled
Delivery string `json:"delivery"` // complete|summary-only|partial
DeliveryReason string `json:"deliveryReason,omitempty"`
AuthorizationEpoch string `json:"authorizationEpoch"`
ObservedAt time.Time `json:"observedAt"`
EventID string `json:"eventId"`
Phase string `json:"phase"`
Actor string `json:"actor"`
Owner string `json:"owner"`
ProjectID core.ID `json:"projectId"`
ConversationID core.ID `json:"conversationId,omitempty"`
RunID core.ID `json:"runId,omitempty"`
SourceKind string `json:"sourceKind"`
SourceID string `json:"sourceId"`
SourceVersion string `json:"sourceVersion"`
SourceSHA256 string `json:"sourceSha256"`
PartIndex int `json:"partIndex"`
SpanStart int `json:"spanStart"` // UTF-8 byte offset in the exact source
SpanEnd int `json:"spanEnd"`
Text string `json:"text,omitempty"` // only the actual authorized fragment
Scope string `json:"scope"` // private|project|controlled
Delivery string `json:"delivery"` // complete|summary-only|partial
DeliveryReason string `json:"deliveryReason,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
AuthorizationEpoch string `json:"authorizationEpoch"`
ObservedAt time.Time `json:"observedAt"`
}
type WorkObservationState string