package projectcontext import "context" type workflowStepAttemptKey struct{} type resolveScopeKey struct{} type resolveScope struct{ goal, targetID string } // WithWorkflowStepAttempt is used by the trusted squad executor adapter. The // value comes from the engine's persisted step attempt, never from model text. func WithWorkflowStepAttempt(ctx context.Context, attemptID string) context.Context { return context.WithValue(ctx, workflowStepAttemptKey{}, attemptID) } func WorkflowStepAttempt(ctx context.Context) string { value, _ := ctx.Value(workflowStepAttemptKey{}).(string) return value } // WithResolveScope carries the exact selector used for this model request to // Backend's trusted receipt writer. It is saved separately from the public // final-input manifest and survives a resumed workflow judge. func WithResolveScope(ctx context.Context, goal, targetID string) context.Context { return context.WithValue(ctx, resolveScopeKey{}, resolveScope{goal: goal, targetID: targetID}) } func ResolveScope(ctx context.Context) (goal, targetID string, ok bool) { scope, ok := ctx.Value(resolveScopeKey{}).(resolveScope) return scope.goal, scope.targetID, ok }